Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
feat: add the ability to specify the key pair class when creating sui…
Browse files Browse the repository at this point in the history
…tes(#66)
  • Loading branch information
tplooker authored Jul 29, 2020
1 parent 3df0958 commit 1fb03cf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/BbsBlsSignature2020.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export class BbsBlsSignature2020 extends suites.LinkedDataProof {
signer,
key,
date,
useNativeCanonize
useNativeCanonize,
LDKeyClass
} = options;
// validate common options
if (
Expand All @@ -59,7 +60,7 @@ export class BbsBlsSignature2020 extends suites.LinkedDataProof {
type: "BbsBlsSignature2020"
};

this.LDKeyClass = Bls12381G2KeyPair;
this.LDKeyClass = LDKeyClass ?? Bls12381G2KeyPair;
this.signer = signer;
this.verificationMethod = verificationMethod;
this.proofSignatureKey = "proofValue";
Expand Down
5 changes: 3 additions & 2 deletions src/BbsBlsSignatureProof2020.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { VerifyProofResult } from "./types/VerifyProofResult";
import { Bls12381G2KeyPair } from "@mattrglobal/bls12381-key-pair";

export class BbsBlsSignatureProof2020 extends suites.LinkedDataProof {
constructor({ useNativeCanonize, key }: any = {}) {
constructor({ useNativeCanonize, key, LDKeyClass }: any = {}) {
super({
type:
"https://w3c-ccg.github.io/ldp-bbs2020/context/v1#BbsBlsSignatureProof2020"
Expand All @@ -42,7 +42,8 @@ export class BbsBlsSignatureProof2020 extends suites.LinkedDataProof {
};
this.supportedDeriveProofType =
"https://w3c-ccg.github.io/ldp-bbs2020/context/v1#BbsBlsSignature2020";
this.LDKeyClass = Bls12381G2KeyPair;

this.LDKeyClass = LDKeyClass ?? Bls12381G2KeyPair;
this.proofSignatureKey = "proofValue";
this.key = key;
this.useNativeCanonize = useNativeCanonize;
Expand Down
2 changes: 1 addition & 1 deletion src/types/SignatureSuiteOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface SignatureSuiteOptions {
*/
readonly proof?: any;
/**
* Linked data key class
* Linked Data Key class implementation
*/
readonly LDKeyClass?: any;
}

0 comments on commit 1fb03cf

Please sign in to comment.