@twin.org/identity-connector-entity-storage 0.0.1-next.13 → 0.0.1-next.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.cjs
CHANGED
|
@@ -421,7 +421,7 @@ class EntityStorageIdentityConnector {
|
|
|
421
421
|
finalTypes.push(credType);
|
|
422
422
|
}
|
|
423
423
|
const verifiableCredential = {
|
|
424
|
-
"@context": dataJsonLd.JsonLdProcessor.combineContexts(standardsW3cDid.DidContexts.
|
|
424
|
+
"@context": dataJsonLd.JsonLdProcessor.combineContexts(standardsW3cDid.DidContexts.ContextVCv2, credContext),
|
|
425
425
|
id,
|
|
426
426
|
type: finalTypes,
|
|
427
427
|
credentialSubject: credentialClone,
|
|
@@ -542,9 +542,7 @@ class EntityStorageIdentityConnector {
|
|
|
542
542
|
const revoked = await this.checkRevocation(issuerDidDocument, verifiableCredential.credentialStatus?.revocationBitmapIndex);
|
|
543
543
|
return {
|
|
544
544
|
revoked,
|
|
545
|
-
verifiableCredential: revoked
|
|
546
|
-
? undefined
|
|
547
|
-
: verifiableCredential
|
|
545
|
+
verifiableCredential: revoked ? undefined : verifiableCredential
|
|
548
546
|
};
|
|
549
547
|
}
|
|
550
548
|
catch (error) {
|
|
@@ -689,7 +687,7 @@ class EntityStorageIdentityConnector {
|
|
|
689
687
|
finalTypes.push(types);
|
|
690
688
|
}
|
|
691
689
|
const verifiablePresentation = {
|
|
692
|
-
"@context": dataJsonLd.JsonLdProcessor.combineContexts(standardsW3cDid.DidContexts.
|
|
690
|
+
"@context": dataJsonLd.JsonLdProcessor.combineContexts(standardsW3cDid.DidContexts.ContextVCv2, contexts),
|
|
693
691
|
id: presentationId,
|
|
694
692
|
type: finalTypes,
|
|
695
693
|
verifiableCredential: verifiableCredentials,
|
|
@@ -801,7 +799,7 @@ class EntityStorageIdentityConnector {
|
|
|
801
799
|
* @param controller The controller of the identity who can make changes.
|
|
802
800
|
* @param verificationMethodId The verification method id to use.
|
|
803
801
|
* @param bytes The data bytes to sign.
|
|
804
|
-
* @returns The proof
|
|
802
|
+
* @returns The proof.
|
|
805
803
|
*/
|
|
806
804
|
async createProof(controller, verificationMethodId, bytes) {
|
|
807
805
|
core.Guards.stringValue(this.CLASS_NAME, "controller", controller);
|
|
@@ -834,8 +832,13 @@ class EntityStorageIdentityConnector {
|
|
|
834
832
|
}
|
|
835
833
|
const signature = await this._vaultConnector.sign(this.buildVaultKey(didDocument.id, verificationMethodId), bytes);
|
|
836
834
|
return {
|
|
837
|
-
|
|
838
|
-
|
|
835
|
+
"@context": standardsW3cDid.DidContexts.ContextVCDataIntegrity,
|
|
836
|
+
type: standardsW3cDid.DidTypes.DataIntegrityProof,
|
|
837
|
+
cryptosuite: "eddsa-jcs-2022",
|
|
838
|
+
created: new Date(Date.now()).toISOString(),
|
|
839
|
+
verificationMethod: verificationMethodId,
|
|
840
|
+
proofPurpose: "assertionMethod",
|
|
841
|
+
proofValue: core.Converter.bytesToBase58(signature)
|
|
839
842
|
};
|
|
840
843
|
}
|
|
841
844
|
catch (error) {
|
|
@@ -844,21 +847,27 @@ class EntityStorageIdentityConnector {
|
|
|
844
847
|
}
|
|
845
848
|
/**
|
|
846
849
|
* Verify proof for arbitrary data with the specified verification method.
|
|
847
|
-
* @param verificationMethodId The verification method id to use.
|
|
848
850
|
* @param bytes The data bytes to verify.
|
|
849
|
-
* @param
|
|
850
|
-
* @
|
|
851
|
-
* @returns True if the signature is valid.
|
|
851
|
+
* @param proof The proof to verify.
|
|
852
|
+
* @returns True if the proof is verified.
|
|
852
853
|
*/
|
|
853
|
-
async verifyProof(
|
|
854
|
-
core.Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
|
|
854
|
+
async verifyProof(bytes, proof) {
|
|
855
855
|
core.Guards.uint8Array(this.CLASS_NAME, "bytes", bytes);
|
|
856
|
-
core.Guards.
|
|
857
|
-
core.Guards.
|
|
856
|
+
core.Guards.object(this.CLASS_NAME, "proof", proof);
|
|
857
|
+
core.Guards.stringValue(this.CLASS_NAME, "proof.type", proof.type);
|
|
858
|
+
core.Guards.stringValue(this.CLASS_NAME, "proof.cryptosuite", proof.cryptosuite);
|
|
859
|
+
core.Guards.stringValue(this.CLASS_NAME, "proof.verificationMethod", proof.verificationMethod);
|
|
860
|
+
core.Guards.stringBase58(this.CLASS_NAME, "proof.proofValue", proof.proofValue);
|
|
858
861
|
try {
|
|
859
|
-
|
|
862
|
+
if (proof.type !== standardsW3cDid.DidTypes.DataIntegrityProof) {
|
|
863
|
+
throw new core.GeneralError(this.CLASS_NAME, "proofType", { proofType: proof.type });
|
|
864
|
+
}
|
|
865
|
+
if (proof.cryptosuite !== "eddsa-jcs-2022") {
|
|
866
|
+
throw new core.GeneralError(this.CLASS_NAME, "cryptoSuite", { cryptosuite: proof.cryptosuite });
|
|
867
|
+
}
|
|
868
|
+
const idParts = identityModels.DocumentHelper.parse(proof.verificationMethod);
|
|
860
869
|
if (core.Is.empty(idParts.hash)) {
|
|
861
|
-
throw new core.NotFoundError(this.CLASS_NAME, "missingDid",
|
|
870
|
+
throw new core.NotFoundError(this.CLASS_NAME, "missingDid", proof.verificationMethod);
|
|
862
871
|
}
|
|
863
872
|
const didIdentityDocument = await this._didDocumentEntityStorage.get(idParts.id);
|
|
864
873
|
if (core.Is.undefined(didIdentityDocument)) {
|
|
@@ -869,9 +878,9 @@ class EntityStorageIdentityConnector {
|
|
|
869
878
|
const methods = this.getAllMethods(didDocument);
|
|
870
879
|
const methodAndArray = methods.find(m => {
|
|
871
880
|
if (core.Is.string(m.method)) {
|
|
872
|
-
return m.method ===
|
|
881
|
+
return m.method === proof.verificationMethod;
|
|
873
882
|
}
|
|
874
|
-
return m.method.id ===
|
|
883
|
+
return m.method.id === proof.verificationMethod;
|
|
875
884
|
});
|
|
876
885
|
if (!methodAndArray) {
|
|
877
886
|
throw new core.GeneralError(this.CLASS_NAME, "methodMissing");
|
|
@@ -880,7 +889,7 @@ class EntityStorageIdentityConnector {
|
|
|
880
889
|
if (!core.Is.stringValue(didMethod.publicKeyJwk?.x)) {
|
|
881
890
|
throw new core.GeneralError(this.CLASS_NAME, "publicKeyJwkMissing");
|
|
882
891
|
}
|
|
883
|
-
return this._vaultConnector.verify(this.buildVaultKey(didIdentityDocument.id,
|
|
892
|
+
return this._vaultConnector.verify(this.buildVaultKey(didIdentityDocument.id, proof.verificationMethod), bytes, core.Converter.base58ToBytes(proof.proofValue));
|
|
884
893
|
}
|
|
885
894
|
catch (error) {
|
|
886
895
|
throw new core.GeneralError(this.CLASS_NAME, "verifyProofFailed", undefined, error);
|
package/dist/esm/index.mjs
CHANGED
|
@@ -419,7 +419,7 @@ class EntityStorageIdentityConnector {
|
|
|
419
419
|
finalTypes.push(credType);
|
|
420
420
|
}
|
|
421
421
|
const verifiableCredential = {
|
|
422
|
-
"@context": JsonLdProcessor.combineContexts(DidContexts.
|
|
422
|
+
"@context": JsonLdProcessor.combineContexts(DidContexts.ContextVCv2, credContext),
|
|
423
423
|
id,
|
|
424
424
|
type: finalTypes,
|
|
425
425
|
credentialSubject: credentialClone,
|
|
@@ -540,9 +540,7 @@ class EntityStorageIdentityConnector {
|
|
|
540
540
|
const revoked = await this.checkRevocation(issuerDidDocument, verifiableCredential.credentialStatus?.revocationBitmapIndex);
|
|
541
541
|
return {
|
|
542
542
|
revoked,
|
|
543
|
-
verifiableCredential: revoked
|
|
544
|
-
? undefined
|
|
545
|
-
: verifiableCredential
|
|
543
|
+
verifiableCredential: revoked ? undefined : verifiableCredential
|
|
546
544
|
};
|
|
547
545
|
}
|
|
548
546
|
catch (error) {
|
|
@@ -687,7 +685,7 @@ class EntityStorageIdentityConnector {
|
|
|
687
685
|
finalTypes.push(types);
|
|
688
686
|
}
|
|
689
687
|
const verifiablePresentation = {
|
|
690
|
-
"@context": JsonLdProcessor.combineContexts(DidContexts.
|
|
688
|
+
"@context": JsonLdProcessor.combineContexts(DidContexts.ContextVCv2, contexts),
|
|
691
689
|
id: presentationId,
|
|
692
690
|
type: finalTypes,
|
|
693
691
|
verifiableCredential: verifiableCredentials,
|
|
@@ -799,7 +797,7 @@ class EntityStorageIdentityConnector {
|
|
|
799
797
|
* @param controller The controller of the identity who can make changes.
|
|
800
798
|
* @param verificationMethodId The verification method id to use.
|
|
801
799
|
* @param bytes The data bytes to sign.
|
|
802
|
-
* @returns The proof
|
|
800
|
+
* @returns The proof.
|
|
803
801
|
*/
|
|
804
802
|
async createProof(controller, verificationMethodId, bytes) {
|
|
805
803
|
Guards.stringValue(this.CLASS_NAME, "controller", controller);
|
|
@@ -832,8 +830,13 @@ class EntityStorageIdentityConnector {
|
|
|
832
830
|
}
|
|
833
831
|
const signature = await this._vaultConnector.sign(this.buildVaultKey(didDocument.id, verificationMethodId), bytes);
|
|
834
832
|
return {
|
|
835
|
-
|
|
836
|
-
|
|
833
|
+
"@context": DidContexts.ContextVCDataIntegrity,
|
|
834
|
+
type: DidTypes.DataIntegrityProof,
|
|
835
|
+
cryptosuite: "eddsa-jcs-2022",
|
|
836
|
+
created: new Date(Date.now()).toISOString(),
|
|
837
|
+
verificationMethod: verificationMethodId,
|
|
838
|
+
proofPurpose: "assertionMethod",
|
|
839
|
+
proofValue: Converter.bytesToBase58(signature)
|
|
837
840
|
};
|
|
838
841
|
}
|
|
839
842
|
catch (error) {
|
|
@@ -842,21 +845,27 @@ class EntityStorageIdentityConnector {
|
|
|
842
845
|
}
|
|
843
846
|
/**
|
|
844
847
|
* Verify proof for arbitrary data with the specified verification method.
|
|
845
|
-
* @param verificationMethodId The verification method id to use.
|
|
846
848
|
* @param bytes The data bytes to verify.
|
|
847
|
-
* @param
|
|
848
|
-
* @
|
|
849
|
-
* @returns True if the signature is valid.
|
|
849
|
+
* @param proof The proof to verify.
|
|
850
|
+
* @returns True if the proof is verified.
|
|
850
851
|
*/
|
|
851
|
-
async verifyProof(
|
|
852
|
-
Guards.stringValue(this.CLASS_NAME, "verificationMethodId", verificationMethodId);
|
|
852
|
+
async verifyProof(bytes, proof) {
|
|
853
853
|
Guards.uint8Array(this.CLASS_NAME, "bytes", bytes);
|
|
854
|
-
Guards.
|
|
855
|
-
Guards.
|
|
854
|
+
Guards.object(this.CLASS_NAME, "proof", proof);
|
|
855
|
+
Guards.stringValue(this.CLASS_NAME, "proof.type", proof.type);
|
|
856
|
+
Guards.stringValue(this.CLASS_NAME, "proof.cryptosuite", proof.cryptosuite);
|
|
857
|
+
Guards.stringValue(this.CLASS_NAME, "proof.verificationMethod", proof.verificationMethod);
|
|
858
|
+
Guards.stringBase58(this.CLASS_NAME, "proof.proofValue", proof.proofValue);
|
|
856
859
|
try {
|
|
857
|
-
|
|
860
|
+
if (proof.type !== DidTypes.DataIntegrityProof) {
|
|
861
|
+
throw new GeneralError(this.CLASS_NAME, "proofType", { proofType: proof.type });
|
|
862
|
+
}
|
|
863
|
+
if (proof.cryptosuite !== "eddsa-jcs-2022") {
|
|
864
|
+
throw new GeneralError(this.CLASS_NAME, "cryptoSuite", { cryptosuite: proof.cryptosuite });
|
|
865
|
+
}
|
|
866
|
+
const idParts = DocumentHelper.parse(proof.verificationMethod);
|
|
858
867
|
if (Is.empty(idParts.hash)) {
|
|
859
|
-
throw new NotFoundError(this.CLASS_NAME, "missingDid",
|
|
868
|
+
throw new NotFoundError(this.CLASS_NAME, "missingDid", proof.verificationMethod);
|
|
860
869
|
}
|
|
861
870
|
const didIdentityDocument = await this._didDocumentEntityStorage.get(idParts.id);
|
|
862
871
|
if (Is.undefined(didIdentityDocument)) {
|
|
@@ -867,9 +876,9 @@ class EntityStorageIdentityConnector {
|
|
|
867
876
|
const methods = this.getAllMethods(didDocument);
|
|
868
877
|
const methodAndArray = methods.find(m => {
|
|
869
878
|
if (Is.string(m.method)) {
|
|
870
|
-
return m.method ===
|
|
879
|
+
return m.method === proof.verificationMethod;
|
|
871
880
|
}
|
|
872
|
-
return m.method.id ===
|
|
881
|
+
return m.method.id === proof.verificationMethod;
|
|
873
882
|
});
|
|
874
883
|
if (!methodAndArray) {
|
|
875
884
|
throw new GeneralError(this.CLASS_NAME, "methodMissing");
|
|
@@ -878,7 +887,7 @@ class EntityStorageIdentityConnector {
|
|
|
878
887
|
if (!Is.stringValue(didMethod.publicKeyJwk?.x)) {
|
|
879
888
|
throw new GeneralError(this.CLASS_NAME, "publicKeyJwkMissing");
|
|
880
889
|
}
|
|
881
|
-
return this._vaultConnector.verify(this.buildVaultKey(didIdentityDocument.id,
|
|
890
|
+
return this._vaultConnector.verify(this.buildVaultKey(didIdentityDocument.id, proof.verificationMethod), bytes, Converter.base58ToBytes(proof.proofValue));
|
|
882
891
|
}
|
|
883
892
|
catch (error) {
|
|
884
893
|
throw new GeneralError(this.CLASS_NAME, "verifyProofFailed", undefined, error);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type IJsonLdContextDefinitionRoot, type
|
|
1
|
+
import { type IJsonLdContextDefinitionRoot, type IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
2
|
import { type IIdentityConnector } from "@twin.org/identity-models";
|
|
3
|
-
import { DidVerificationMethodType, type IDidDocument, type IDidDocumentVerificationMethod, type IDidService, type IDidVerifiableCredential, type IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
|
|
3
|
+
import { DidVerificationMethodType, type IDidDocument, type IDidDocumentVerificationMethod, type IDidProof, type IDidService, type IDidVerifiableCredential, type IDidVerifiablePresentation } from "@twin.org/standards-w3c-did";
|
|
4
4
|
/**
|
|
5
5
|
* Class for performing identity operations using entity storage.
|
|
6
6
|
*/
|
|
@@ -85,8 +85,8 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
|
|
|
85
85
|
* @returns The created verifiable credential and its token.
|
|
86
86
|
* @throws NotFoundError if the id can not be resolved.
|
|
87
87
|
*/
|
|
88
|
-
createVerifiableCredential
|
|
89
|
-
verifiableCredential: IDidVerifiableCredential
|
|
88
|
+
createVerifiableCredential(controller: string, verificationMethodId: string, id: string | undefined, credential: IJsonLdNodeObject, revocationIndex?: number): Promise<{
|
|
89
|
+
verifiableCredential: IDidVerifiableCredential;
|
|
90
90
|
jwt: string;
|
|
91
91
|
}>;
|
|
92
92
|
/**
|
|
@@ -94,9 +94,9 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
|
|
|
94
94
|
* @param credentialJwt The credential to verify.
|
|
95
95
|
* @returns The credential stored in the jwt and the revocation status.
|
|
96
96
|
*/
|
|
97
|
-
checkVerifiableCredential
|
|
97
|
+
checkVerifiableCredential(credentialJwt: string): Promise<{
|
|
98
98
|
revoked: boolean;
|
|
99
|
-
verifiableCredential?: IDidVerifiableCredential
|
|
99
|
+
verifiableCredential?: IDidVerifiableCredential;
|
|
100
100
|
}>;
|
|
101
101
|
/**
|
|
102
102
|
* Revoke verifiable credential(s).
|
|
@@ -126,8 +126,8 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
|
|
|
126
126
|
* @returns The created verifiable presentation and its token.
|
|
127
127
|
* @throws NotFoundError if the id can not be resolved.
|
|
128
128
|
*/
|
|
129
|
-
createVerifiablePresentation
|
|
130
|
-
verifiablePresentation: IDidVerifiablePresentation
|
|
129
|
+
createVerifiablePresentation(controller: string, presentationMethodId: string, presentationId: string | undefined, contexts: IJsonLdContextDefinitionRoot | undefined, types: string | string[] | undefined, verifiableCredentials: (string | IDidVerifiableCredential)[], expiresInMinutes?: number): Promise<{
|
|
130
|
+
verifiablePresentation: IDidVerifiablePresentation;
|
|
131
131
|
jwt: string;
|
|
132
132
|
}>;
|
|
133
133
|
/**
|
|
@@ -135,9 +135,9 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
|
|
|
135
135
|
* @param presentationJwt The presentation to verify.
|
|
136
136
|
* @returns The presentation stored in the jwt and the revocation status.
|
|
137
137
|
*/
|
|
138
|
-
checkVerifiablePresentation
|
|
138
|
+
checkVerifiablePresentation(presentationJwt: string): Promise<{
|
|
139
139
|
revoked: boolean;
|
|
140
|
-
verifiablePresentation?: IDidVerifiablePresentation
|
|
140
|
+
verifiablePresentation?: IDidVerifiablePresentation;
|
|
141
141
|
issuers?: IDidDocument[];
|
|
142
142
|
}>;
|
|
143
143
|
/**
|
|
@@ -145,19 +145,14 @@ export declare class EntityStorageIdentityConnector implements IIdentityConnecto
|
|
|
145
145
|
* @param controller The controller of the identity who can make changes.
|
|
146
146
|
* @param verificationMethodId The verification method id to use.
|
|
147
147
|
* @param bytes The data bytes to sign.
|
|
148
|
-
* @returns The proof
|
|
148
|
+
* @returns The proof.
|
|
149
149
|
*/
|
|
150
|
-
createProof(controller: string, verificationMethodId: string, bytes: Uint8Array): Promise<
|
|
151
|
-
type: string;
|
|
152
|
-
value: Uint8Array;
|
|
153
|
-
}>;
|
|
150
|
+
createProof(controller: string, verificationMethodId: string, bytes: Uint8Array): Promise<IDidProof>;
|
|
154
151
|
/**
|
|
155
152
|
* Verify proof for arbitrary data with the specified verification method.
|
|
156
|
-
* @param verificationMethodId The verification method id to use.
|
|
157
153
|
* @param bytes The data bytes to verify.
|
|
158
|
-
* @param
|
|
159
|
-
* @
|
|
160
|
-
* @returns True if the signature is valid.
|
|
154
|
+
* @param proof The proof to verify.
|
|
155
|
+
* @returns True if the proof is verified.
|
|
161
156
|
*/
|
|
162
|
-
verifyProof(
|
|
157
|
+
verifyProof(bytes: Uint8Array, proof: IDidProof): Promise<boolean>;
|
|
163
158
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -264,14 +264,10 @@ NotFoundError if the id can not be resolved.
|
|
|
264
264
|
|
|
265
265
|
### createVerifiableCredential()
|
|
266
266
|
|
|
267
|
-
> **createVerifiableCredential
|
|
267
|
+
> **createVerifiableCredential**(`controller`, `verificationMethodId`, `id`, `credential`, `revocationIndex`?): `Promise`\<`object`\>
|
|
268
268
|
|
|
269
269
|
Create a verifiable credential for a verification method.
|
|
270
270
|
|
|
271
|
-
#### Type Parameters
|
|
272
|
-
|
|
273
|
-
• **T** *extends* `IJsonLdObject`
|
|
274
|
-
|
|
275
271
|
#### Parameters
|
|
276
272
|
|
|
277
273
|
• **controller**: `string`
|
|
@@ -286,7 +282,7 @@ The verification method id to use.
|
|
|
286
282
|
|
|
287
283
|
The id of the credential.
|
|
288
284
|
|
|
289
|
-
• **credential**: `
|
|
285
|
+
• **credential**: `IJsonLdNodeObject`
|
|
290
286
|
|
|
291
287
|
The credential to store in the verifiable credential.
|
|
292
288
|
|
|
@@ -302,7 +298,7 @@ The created verifiable credential and its token.
|
|
|
302
298
|
|
|
303
299
|
##### verifiableCredential
|
|
304
300
|
|
|
305
|
-
> **verifiableCredential**: `IDidVerifiableCredential
|
|
301
|
+
> **verifiableCredential**: `IDidVerifiableCredential`
|
|
306
302
|
|
|
307
303
|
##### jwt
|
|
308
304
|
|
|
@@ -320,14 +316,10 @@ NotFoundError if the id can not be resolved.
|
|
|
320
316
|
|
|
321
317
|
### checkVerifiableCredential()
|
|
322
318
|
|
|
323
|
-
> **checkVerifiableCredential
|
|
319
|
+
> **checkVerifiableCredential**(`credentialJwt`): `Promise`\<`object`\>
|
|
324
320
|
|
|
325
321
|
Check a verifiable credential is valid.
|
|
326
322
|
|
|
327
|
-
#### Type Parameters
|
|
328
|
-
|
|
329
|
-
• **T** *extends* `IJsonLdObject`
|
|
330
|
-
|
|
331
323
|
#### Parameters
|
|
332
324
|
|
|
333
325
|
• **credentialJwt**: `string`
|
|
@@ -346,7 +338,7 @@ The credential stored in the jwt and the revocation status.
|
|
|
346
338
|
|
|
347
339
|
##### verifiableCredential?
|
|
348
340
|
|
|
349
|
-
> `optional` **verifiableCredential**: `IDidVerifiableCredential
|
|
341
|
+
> `optional` **verifiableCredential**: `IDidVerifiableCredential`
|
|
350
342
|
|
|
351
343
|
#### Implementation of
|
|
352
344
|
|
|
@@ -420,14 +412,10 @@ Nothing.
|
|
|
420
412
|
|
|
421
413
|
### createVerifiablePresentation()
|
|
422
414
|
|
|
423
|
-
> **createVerifiablePresentation
|
|
415
|
+
> **createVerifiablePresentation**(`controller`, `presentationMethodId`, `presentationId`, `contexts`, `types`, `verifiableCredentials`, `expiresInMinutes`?): `Promise`\<`object`\>
|
|
424
416
|
|
|
425
417
|
Create a verifiable presentation from the supplied verifiable credentials.
|
|
426
418
|
|
|
427
|
-
#### Type Parameters
|
|
428
|
-
|
|
429
|
-
• **T** *extends* `IJsonLdObject`
|
|
430
|
-
|
|
431
419
|
#### Parameters
|
|
432
420
|
|
|
433
421
|
• **controller**: `string`
|
|
@@ -450,7 +438,7 @@ The contexts for the data stored in the verifiable credential.
|
|
|
450
438
|
|
|
451
439
|
The types for the data stored in the verifiable credential.
|
|
452
440
|
|
|
453
|
-
• **verifiableCredentials**: (`string` \| `IDidVerifiableCredential
|
|
441
|
+
• **verifiableCredentials**: (`string` \| `IDidVerifiableCredential`)[]
|
|
454
442
|
|
|
455
443
|
The credentials to use for creating the presentation in jwt format.
|
|
456
444
|
|
|
@@ -466,7 +454,7 @@ The created verifiable presentation and its token.
|
|
|
466
454
|
|
|
467
455
|
##### verifiablePresentation
|
|
468
456
|
|
|
469
|
-
> **verifiablePresentation**: `IDidVerifiablePresentation
|
|
457
|
+
> **verifiablePresentation**: `IDidVerifiablePresentation`
|
|
470
458
|
|
|
471
459
|
##### jwt
|
|
472
460
|
|
|
@@ -484,14 +472,10 @@ NotFoundError if the id can not be resolved.
|
|
|
484
472
|
|
|
485
473
|
### checkVerifiablePresentation()
|
|
486
474
|
|
|
487
|
-
> **checkVerifiablePresentation
|
|
475
|
+
> **checkVerifiablePresentation**(`presentationJwt`): `Promise`\<`object`\>
|
|
488
476
|
|
|
489
477
|
Check a verifiable presentation is valid.
|
|
490
478
|
|
|
491
|
-
#### Type Parameters
|
|
492
|
-
|
|
493
|
-
• **T** *extends* `IJsonLdObject`
|
|
494
|
-
|
|
495
479
|
#### Parameters
|
|
496
480
|
|
|
497
481
|
• **presentationJwt**: `string`
|
|
@@ -510,7 +494,7 @@ The presentation stored in the jwt and the revocation status.
|
|
|
510
494
|
|
|
511
495
|
##### verifiablePresentation?
|
|
512
496
|
|
|
513
|
-
> `optional` **verifiablePresentation**: `IDidVerifiablePresentation
|
|
497
|
+
> `optional` **verifiablePresentation**: `IDidVerifiablePresentation`
|
|
514
498
|
|
|
515
499
|
##### issuers?
|
|
516
500
|
|
|
@@ -524,7 +508,7 @@ The presentation stored in the jwt and the revocation status.
|
|
|
524
508
|
|
|
525
509
|
### createProof()
|
|
526
510
|
|
|
527
|
-
> **createProof**(`controller`, `verificationMethodId`, `bytes`): `Promise`\<`
|
|
511
|
+
> **createProof**(`controller`, `verificationMethodId`, `bytes`): `Promise`\<`IDidProof`\>
|
|
528
512
|
|
|
529
513
|
Create a proof for arbitrary data with the specified verification method.
|
|
530
514
|
|
|
@@ -544,17 +528,9 @@ The data bytes to sign.
|
|
|
544
528
|
|
|
545
529
|
#### Returns
|
|
546
530
|
|
|
547
|
-
`Promise`\<`
|
|
548
|
-
|
|
549
|
-
The proof signature type and value.
|
|
531
|
+
`Promise`\<`IDidProof`\>
|
|
550
532
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
> **type**: `string`
|
|
554
|
-
|
|
555
|
-
##### value
|
|
556
|
-
|
|
557
|
-
> **value**: `Uint8Array`
|
|
533
|
+
The proof.
|
|
558
534
|
|
|
559
535
|
#### Implementation of
|
|
560
536
|
|
|
@@ -564,33 +540,25 @@ The proof signature type and value.
|
|
|
564
540
|
|
|
565
541
|
### verifyProof()
|
|
566
542
|
|
|
567
|
-
> **verifyProof**(`
|
|
543
|
+
> **verifyProof**(`bytes`, `proof`): `Promise`\<`boolean`\>
|
|
568
544
|
|
|
569
545
|
Verify proof for arbitrary data with the specified verification method.
|
|
570
546
|
|
|
571
547
|
#### Parameters
|
|
572
548
|
|
|
573
|
-
• **verificationMethodId**: `string`
|
|
574
|
-
|
|
575
|
-
The verification method id to use.
|
|
576
|
-
|
|
577
549
|
• **bytes**: `Uint8Array`
|
|
578
550
|
|
|
579
551
|
The data bytes to verify.
|
|
580
552
|
|
|
581
|
-
• **
|
|
582
|
-
|
|
583
|
-
The type of the signature for the proof.
|
|
584
|
-
|
|
585
|
-
• **signatureValue**: `Uint8Array`
|
|
553
|
+
• **proof**: `IDidProof`
|
|
586
554
|
|
|
587
|
-
The
|
|
555
|
+
The proof to verify.
|
|
588
556
|
|
|
589
557
|
#### Returns
|
|
590
558
|
|
|
591
559
|
`Promise`\<`boolean`\>
|
|
592
560
|
|
|
593
|
-
True if the
|
|
561
|
+
True if the proof is verified.
|
|
594
562
|
|
|
595
563
|
#### Implementation of
|
|
596
564
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/identity-connector-entity-storage",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.15",
|
|
4
4
|
"description": "Identity connector implementation using entity storage",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@twin.org/data-core": "next",
|
|
20
20
|
"@twin.org/data-json-ld": "next",
|
|
21
21
|
"@twin.org/entity": "next",
|
|
22
|
-
"@twin.org/identity-models": "0.0.1-next.
|
|
22
|
+
"@twin.org/identity-models": "0.0.1-next.15",
|
|
23
23
|
"@twin.org/nameof": "next",
|
|
24
24
|
"@twin.org/standards-w3c-did": "next",
|
|
25
25
|
"@twin.org/vault-models": "next",
|