@twin.org/identity-models 0.0.3-next.34 → 0.0.3-next.36

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.
Files changed (29) hide show
  1. package/dist/es/contextIdHandlers/didContextIdHandler.js +3 -3
  2. package/dist/es/contextIdHandlers/didContextIdHandler.js.map +1 -1
  3. package/dist/es/models/IIdentityComponent.js.map +1 -1
  4. package/dist/es/models/IIdentityConnector.js.map +1 -1
  5. package/dist/es/models/IIdentityProfileComponent.js.map +1 -1
  6. package/dist/es/models/IIdentityProfileConnector.js.map +1 -1
  7. package/dist/es/models/identityMetricIds.js.map +1 -1
  8. package/dist/es/types/did.js +3 -3
  9. package/dist/es/types/did.js.map +1 -1
  10. package/dist/es/utils/verificationHelper.js +4 -4
  11. package/dist/es/utils/verificationHelper.js.map +1 -1
  12. package/dist/types/contextIdHandlers/didContextIdHandler.d.ts +3 -3
  13. package/dist/types/models/IIdentityComponent.d.ts +9 -9
  14. package/dist/types/models/IIdentityConnector.d.ts +8 -8
  15. package/dist/types/models/IIdentityProfileComponent.d.ts +3 -3
  16. package/dist/types/models/IIdentityProfileConnector.d.ts +3 -3
  17. package/dist/types/models/identityMetricIds.d.ts +1 -1
  18. package/dist/types/types/did.d.ts +3 -3
  19. package/dist/types/utils/verificationHelper.d.ts +4 -4
  20. package/docs/changelog.md +14 -0
  21. package/docs/reference/classes/Did.md +3 -3
  22. package/docs/reference/classes/DidContextIdHandler.md +3 -3
  23. package/docs/reference/classes/VerificationHelper.md +4 -4
  24. package/docs/reference/interfaces/IIdentityComponent.md +9 -9
  25. package/docs/reference/interfaces/IIdentityConnector.md +8 -8
  26. package/docs/reference/interfaces/IIdentityProfileComponent.md +3 -3
  27. package/docs/reference/interfaces/IIdentityProfileConnector.md +3 -3
  28. package/docs/reference/type-aliases/IdentityMetricIds.md +1 -1
  29. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { Converter, HexHelper } from "@twin.org/core";
2
2
  import { Did } from "../types/did.js";
3
3
  /**
4
- * Context Id handler for testing as a DID.
4
+ * Context ID handler that treats context identifiers as DIDs.
5
5
  */
6
6
  export class DidContextIdHandler {
7
7
  /**
@@ -30,9 +30,9 @@ export class DidContextIdHandler {
30
30
  return parts.id;
31
31
  }
32
32
  /**
33
- * Guard the value ensuring length.
33
+ * Guard the value ensuring it is a valid DID.
34
34
  * @param value The value to guard.
35
- * @throws GeneralError if the value is too short.
35
+ * @throws GeneralError if the value is not a valid DID.
36
36
  */
37
37
  guard(value) {
38
38
  Did.guard(DidContextIdHandler.CLASS_NAME, "value", value);
@@ -1 +1 @@
1
- {"version":3,"file":"didContextIdHandler.js","sourceRoot":"","sources":["../../../src/contextIdHandlers/didContextIdHandler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC/B;;OAEG;IACI,MAAM,CAAU,UAAU,yBAAyC;IAE1E;;;OAGG;IACI,SAAS;QACf,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAa;QACzB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,yEAAyE;QACzE,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;YACtE,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC7C,OAAO,SAAS,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,KAAK,CAAC,EAAE,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAa;QACzB,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;IACjE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIdHandler } from \"@twin.org/context\";\nimport { Converter, HexHelper } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { Did } from \"../types/did.js\";\n\n/**\n * Context Id handler for testing as a DID.\n */\nexport class DidContextIdHandler implements IContextIdHandler {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DidContextIdHandler>();\n\n\t/**\n\t * The class name of the component.\n\t * @returns The class name.\n\t */\n\tpublic className(): string {\n\t\treturn DidContextIdHandler.CLASS_NAME;\n\t}\n\n\t/**\n\t * Get the short form of the DID which is the last part.\n\t * @param value The full context id value.\n\t * @returns Short form string.\n\t */\n\tpublic short(value: string): string {\n\t\tconst parts = Did.parse(value);\n\t\t// If the ID part is hex, convert to base64 for a shorter representation.\n\t\tif (HexHelper.hasPrefix(parts.id) && HexHelper.isHex(parts.id, true)) {\n\t\t\tconst bytes = Converter.hexToBytes(parts.id);\n\t\t\treturn Converter.bytesToBase64Url(bytes);\n\t\t}\n\t\treturn parts.id;\n\t}\n\n\t/**\n\t * Guard the value ensuring length.\n\t * @param value The value to guard.\n\t * @throws GeneralError if the value is too short.\n\t */\n\tpublic guard(value: string): void {\n\t\tDid.guard(DidContextIdHandler.CLASS_NAME, nameof(value), value);\n\t}\n}\n"]}
1
+ {"version":3,"file":"didContextIdHandler.js","sourceRoot":"","sources":["../../../src/contextIdHandlers/didContextIdHandler.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC/B;;OAEG;IACI,MAAM,CAAU,UAAU,yBAAyC;IAE1E;;;OAGG;IACI,SAAS;QACf,OAAO,mBAAmB,CAAC,UAAU,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAa;QACzB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC/B,yEAAyE;QACzE,IAAI,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;YACtE,MAAM,KAAK,GAAG,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC7C,OAAO,SAAS,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,KAAK,CAAC,EAAE,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAa;QACzB,GAAG,CAAC,KAAK,CAAC,mBAAmB,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;IACjE,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IContextIdHandler } from \"@twin.org/context\";\nimport { Converter, HexHelper } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { Did } from \"../types/did.js\";\n\n/**\n * Context ID handler that treats context identifiers as DIDs.\n */\nexport class DidContextIdHandler implements IContextIdHandler {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<DidContextIdHandler>();\n\n\t/**\n\t * The class name of the component.\n\t * @returns The class name.\n\t */\n\tpublic className(): string {\n\t\treturn DidContextIdHandler.CLASS_NAME;\n\t}\n\n\t/**\n\t * Get the short form of the DID which is the last part.\n\t * @param value The full context id value.\n\t * @returns Short form string.\n\t */\n\tpublic short(value: string): string {\n\t\tconst parts = Did.parse(value);\n\t\t// If the ID part is hex, convert to base64 for a shorter representation.\n\t\tif (HexHelper.hasPrefix(parts.id) && HexHelper.isHex(parts.id, true)) {\n\t\t\tconst bytes = Converter.hexToBytes(parts.id);\n\t\t\treturn Converter.bytesToBase64Url(bytes);\n\t\t}\n\t\treturn parts.id;\n\t}\n\n\t/**\n\t * Guard the value ensuring it is a valid DID.\n\t * @param value The value to guard.\n\t * @throws GeneralError if the value is not a valid DID.\n\t */\n\tpublic guard(value: string): void {\n\t\tDid.guard(DidContextIdHandler.CLASS_NAME, nameof(value), value);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IIdentityComponent.js","sourceRoot":"","sources":["../../../src/models/IIdentityComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tDidVerificationMethodType,\n\tIDidDocument,\n\tIDidDocumentVerificationMethod,\n\tIProof,\n\tIDidService,\n\tIDidVerifiableCredential,\n\tIDidVerifiablePresentation,\n\tProofTypes\n} from \"@twin.org/standards-w3c-did\";\n\n/**\n * Interface describing a contract which provides identity operations.\n */\nexport interface IIdentityComponent extends IComponent {\n\t/**\n\t * Create a new identity.\n\t * @param namespace The namespace of the connector to use for the identity, defaults to service configured namespace.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created identity document.\n\t */\n\tidentityCreate(namespace?: string, controller?: string): Promise<IDidDocument>;\n\n\t/**\n\t * Remove an identity.\n\t * @param identity The id of the document to remove.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t */\n\tidentityRemove(identity: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add a verification method to the document in JSON Web key Format.\n\t * @param identity The id of the document to add the verification method to.\n\t * @param verificationMethodType The type of the verification method to add.\n\t * @param verificationMethodId The id of the verification method, if undefined uses the kid of the generated JWK.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The verification method.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple keys.\n\t */\n\tverificationMethodCreate(\n\t\tidentity: string,\n\t\tverificationMethodType: DidVerificationMethodType,\n\t\tverificationMethodId?: string,\n\t\tcontroller?: string\n\t): Promise<IDidDocumentVerificationMethod>;\n\n\t/**\n\t * Remove a verification method from the document.\n\t * @param verificationMethodId The id of the verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple revocable keys.\n\t */\n\tverificationMethodRemove(verificationMethodId: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add a service to the document.\n\t * @param identity The id of the document to add the service to.\n\t * @param serviceId The id of the service.\n\t * @param serviceType The type of the service.\n\t * @param serviceEndpoint The endpoint for the service.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The service.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tserviceCreate(\n\t\tidentity: string,\n\t\tserviceId: string,\n\t\tserviceType: string | string[],\n\t\tserviceEndpoint: string | string[],\n\t\tcontroller?: string\n\t): Promise<IDidService>;\n\n\t/**\n\t * Remove a service from the document.\n\t * @param serviceId The id of the service.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tserviceRemove(serviceId: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add an alias to the alsoKnownAs property on the document.\n\t * If the alias is already present the operation is a no-op.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to add. Must be a Url or Urn (typically another DID).\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\talsoKnownAsAdd(documentId: string, alias: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Remove an alias from the alsoKnownAs property on the document.\n\t * If the alias is not present the operation is a no-op.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to remove. Must be a Url or Urn.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\talsoKnownAsRemove(documentId: string, alias: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Create a verifiable credential for a verification method.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param id The id of the credential.\n\t * @param subject The credential subject to store in the verifiable credential.\n\t * @param options Additional options for creating the verifiable credential.\n\t * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t * @param options.expirationDate The date the verifiable credential is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable credential in jwt format.\n\t * @param options.jwtPayloadFields Additional fields to include in the JWT payload when creating the verifiable credential in jwt format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created verifiable credential and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tverifiableCredentialCreate(\n\t\tverificationMethodId: string,\n\t\tid: string | undefined,\n\t\tsubject: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\trevocationIndex?: number;\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t},\n\t\tcontroller?: string\n\t): Promise<{\n\t\tverifiableCredential: IDidVerifiableCredential;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Verify a verifiable credential is valid.\n\t * @param credential The credential to verify.\n\t * @returns The credential stored in the jwt and the revocation status.\n\t */\n\tverifiableCredentialVerify(credential: string | IDidVerifiableCredential): Promise<{\n\t\trevoked: boolean;\n\t\tverifiableCredential?: IDidVerifiableCredential;\n\t}>;\n\n\t/**\n\t * Revoke verifiable credential.\n\t * @param issuerId The id of the document to update the revocation list for.\n\t * @param credentialIndex The revocation bitmap index revoke.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t */\n\tverifiableCredentialRevoke(\n\t\tissuerId: string,\n\t\tcredentialIndex: number,\n\t\tcontroller?: string\n\t): Promise<void>;\n\n\t/**\n\t * Unrevoke verifiable credential.\n\t * @param issuerId The id of the document to update the revocation list for.\n\t * @param credentialIndex The revocation bitmap index to un revoke.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns Nothing.\n\t */\n\tverifiableCredentialUnrevoke(\n\t\tissuerId: string,\n\t\tcredentialIndex: number,\n\t\tcontroller?: string\n\t): Promise<void>;\n\n\t/**\n\t * Create a verifiable presentation from the supplied verifiable credentials.\n\t * @param verificationMethodId The method to associate with the presentation.\n\t * @param presentationId The id of the presentation.\n\t * @param contexts The contexts for the data stored in the verifiable credential.\n\t * @param types The types for the data stored in the verifiable credential.\n\t * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.\n\t * @param options Additional options for creating the verifiable presentation.\n\t * @param options.expirationDate The date the verifiable presentation is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable presentation in jwt format.\n\t * @param options.jwtPayloadFields\tAdditional fields to include in the JWT payload when creating the verifiable presentation in jwt format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created verifiable presentation and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tverifiablePresentationCreate(\n\t\tverificationMethodId: string,\n\t\tpresentationId: string | undefined,\n\t\tcontexts: IJsonLdContextDefinitionRoot | undefined,\n\t\ttypes: string | string[] | undefined,\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[],\n\t\toptions?: {\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t},\n\t\tcontroller?: string\n\t): Promise<{\n\t\tverifiablePresentation: IDidVerifiablePresentation;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Verify a verifiable presentation is valid.\n\t * @param presentation The presentation to verify.\n\t * @returns The presentation stored in the jwt and the revocation status.\n\t */\n\tverifiablePresentationVerify(presentation: string | IDidVerifiablePresentation): Promise<{\n\t\trevoked: boolean;\n\t\tverifiablePresentation?: IDidVerifiablePresentation;\n\t\tissuers?: IDidDocument[];\n\t}>;\n\n\t/**\n\t * Create a proof for a document with the specified verification method.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param proofType The type of proof to create.\n\t * @param unsecureDocument The unsecure document to create the proof for.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The proof.\n\t */\n\tproofCreate(\n\t\tverificationMethodId: string,\n\t\tproofType: ProofTypes,\n\t\tunsecureDocument: IJsonLdNodeObject,\n\t\tcontroller?: string\n\t): Promise<IProof>;\n\n\t/**\n\t * Verify proof for a document with the specified verification method.\n\t * @param document The document to verify.\n\t * @param proof The proof to verify.\n\t * @returns True if the proof is verified.\n\t */\n\tproofVerify(document: IJsonLdNodeObject, proof: IProof): Promise<boolean>;\n}\n"]}
1
+ {"version":3,"file":"IIdentityComponent.js","sourceRoot":"","sources":["../../../src/models/IIdentityComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tDidVerificationMethodType,\n\tIDidDocument,\n\tIDidDocumentVerificationMethod,\n\tIProof,\n\tIDidService,\n\tIDidVerifiableCredential,\n\tIDidVerifiablePresentation,\n\tProofTypes\n} from \"@twin.org/standards-w3c-did\";\n\n/**\n * Interface describing a contract which provides identity operations.\n */\nexport interface IIdentityComponent extends IComponent {\n\t/**\n\t * Create a new identity.\n\t * @param namespace The namespace of the connector to use for the identity, defaults to service configured namespace.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created identity document.\n\t */\n\tidentityCreate(namespace?: string, controller?: string): Promise<IDidDocument>;\n\n\t/**\n\t * Remove an identity.\n\t * @param identity The id of the document to remove.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the identity has been removed.\n\t */\n\tidentityRemove(identity: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add a verification method to the document in JSON Web key Format.\n\t * @param identity The id of the document to add the verification method to.\n\t * @param verificationMethodType The type of the verification method to add.\n\t * @param verificationMethodId The id of the verification method, if undefined uses the kid of the generated JWK.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The verification method.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple keys.\n\t */\n\tverificationMethodCreate(\n\t\tidentity: string,\n\t\tverificationMethodType: DidVerificationMethodType,\n\t\tverificationMethodId?: string,\n\t\tcontroller?: string\n\t): Promise<IDidDocumentVerificationMethod>;\n\n\t/**\n\t * Remove a verification method from the document.\n\t * @param verificationMethodId The id of the verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the verification method has been removed.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple revocable keys.\n\t */\n\tverificationMethodRemove(verificationMethodId: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add a service to the document.\n\t * @param identity The id of the document to add the service to.\n\t * @param serviceId The id of the service.\n\t * @param serviceType The type of the service.\n\t * @param serviceEndpoint The endpoint for the service.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The service.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tserviceCreate(\n\t\tidentity: string,\n\t\tserviceId: string,\n\t\tserviceType: string | string[],\n\t\tserviceEndpoint: string | string[],\n\t\tcontroller?: string\n\t): Promise<IDidService>;\n\n\t/**\n\t * Remove a service from the document.\n\t * @param serviceId The id of the service.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the service has been removed.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tserviceRemove(serviceId: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Add an alias to the alsoKnownAs property on the document.\n\t * If the alias is already present the operation is a no-op.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to add. Must be a Url or Urn (typically another DID).\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the alias has been added.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\talsoKnownAsAdd(documentId: string, alias: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Remove an alias from the alsoKnownAs property on the document.\n\t * If the alias is not present the operation is a no-op.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to remove. Must be a Url or Urn.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the alias has been removed.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\talsoKnownAsRemove(documentId: string, alias: string, controller?: string): Promise<void>;\n\n\t/**\n\t * Create a verifiable credential for a verification method.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param id The id of the credential.\n\t * @param subject The credential subject to store in the verifiable credential.\n\t * @param options Additional options for creating the verifiable credential.\n\t * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t * @param options.expirationDate The date the verifiable credential is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable credential in jwt format.\n\t * @param options.jwtPayloadFields Additional fields to include in the JWT payload when creating the verifiable credential in jwt format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created verifiable credential and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tverifiableCredentialCreate(\n\t\tverificationMethodId: string,\n\t\tid: string | undefined,\n\t\tsubject: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\trevocationIndex?: number;\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t},\n\t\tcontroller?: string\n\t): Promise<{\n\t\tverifiableCredential: IDidVerifiableCredential;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Verify a verifiable credential is valid.\n\t * @param credential The credential to verify.\n\t * @returns The credential stored in the jwt and the revocation status.\n\t */\n\tverifiableCredentialVerify(credential: string | IDidVerifiableCredential): Promise<{\n\t\trevoked: boolean;\n\t\tverifiableCredential?: IDidVerifiableCredential;\n\t}>;\n\n\t/**\n\t * Revoke verifiable credential.\n\t * @param issuerId The id of the document to update the revocation list for.\n\t * @param credentialIndex The revocation bitmap index to revoke.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the credential has been revoked.\n\t */\n\tverifiableCredentialRevoke(\n\t\tissuerId: string,\n\t\tcredentialIndex: number,\n\t\tcontroller?: string\n\t): Promise<void>;\n\n\t/**\n\t * Unrevoke verifiable credential.\n\t * @param issuerId The id of the document to update the revocation list for.\n\t * @param credentialIndex The revocation bitmap index to unrevoke.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns A promise that resolves when the credential has been unrevoked.\n\t */\n\tverifiableCredentialUnrevoke(\n\t\tissuerId: string,\n\t\tcredentialIndex: number,\n\t\tcontroller?: string\n\t): Promise<void>;\n\n\t/**\n\t * Create a verifiable presentation from the supplied verifiable credentials.\n\t * @param verificationMethodId The method to associate with the presentation.\n\t * @param presentationId The id of the presentation.\n\t * @param contexts The contexts for the data stored in the verifiable credential.\n\t * @param types The types for the data stored in the verifiable credential.\n\t * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.\n\t * @param options Additional options for creating the verifiable presentation.\n\t * @param options.expirationDate The date the verifiable presentation is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable presentation in jwt format.\n\t * @param options.jwtPayloadFields\tAdditional fields to include in the JWT payload when creating the verifiable presentation in jwt format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created verifiable presentation and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tverifiablePresentationCreate(\n\t\tverificationMethodId: string,\n\t\tpresentationId: string | undefined,\n\t\tcontexts: IJsonLdContextDefinitionRoot | undefined,\n\t\ttypes: string | string[] | undefined,\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[],\n\t\toptions?: {\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t},\n\t\tcontroller?: string\n\t): Promise<{\n\t\tverifiablePresentation: IDidVerifiablePresentation;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Verify a verifiable presentation is valid.\n\t * @param presentation The presentation to verify.\n\t * @returns The presentation stored in the jwt and the revocation status.\n\t */\n\tverifiablePresentationVerify(presentation: string | IDidVerifiablePresentation): Promise<{\n\t\trevoked: boolean;\n\t\tverifiablePresentation?: IDidVerifiablePresentation;\n\t\tissuers?: IDidDocument[];\n\t}>;\n\n\t/**\n\t * Create a proof for a document with the specified verification method.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param proofType The type of proof to create.\n\t * @param unsecureDocument The unsecure document to create the proof for.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The proof.\n\t */\n\tproofCreate(\n\t\tverificationMethodId: string,\n\t\tproofType: ProofTypes,\n\t\tunsecureDocument: IJsonLdNodeObject,\n\t\tcontroller?: string\n\t): Promise<IProof>;\n\n\t/**\n\t * Verify proof for a document with the specified verification method.\n\t * @param document The document to verify.\n\t * @param proof The proof to verify.\n\t * @returns True if the proof is verified.\n\t */\n\tproofVerify(document: IJsonLdNodeObject, proof: IProof): Promise<boolean>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IIdentityConnector.js","sourceRoot":"","sources":["../../../src/models/IIdentityConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tDidVerificationMethodType,\n\tIDidDocument,\n\tIDidDocumentVerificationMethod,\n\tIProof,\n\tIDidService,\n\tIDidVerifiableCredential,\n\tIDidVerifiablePresentation,\n\tProofTypes\n} from \"@twin.org/standards-w3c-did\";\n\n/**\n * Interface describing an identity connector.\n */\nexport interface IIdentityConnector extends IComponent {\n\t/**\n\t * Create a new document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created document.\n\t */\n\tcreateDocument(controller: string): Promise<IDidDocument>;\n\n\t/**\n\t * Remove a document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to remove.\n\t * @returns Nothing.\n\t */\n\tremoveDocument(controller: string, documentId: string): Promise<void>;\n\n\t/**\n\t * Add a verification method to the document in JSON Web key Format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to add the verification method to.\n\t * @param verificationMethodType The type of the verification method to add.\n\t * @param verificationMethodId The id of the verification method, if undefined uses the kid of the generated JWK.\n\t * @returns The verification method.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple keys.\n\t */\n\taddVerificationMethod(\n\t\tcontroller: string,\n\t\tdocumentId: string,\n\t\tverificationMethodType: DidVerificationMethodType,\n\t\tverificationMethodId?: string\n\t): Promise<IDidDocumentVerificationMethod>;\n\n\t/**\n\t * Remove a verification method from the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The id of the verification method.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple revocable keys.\n\t */\n\tremoveVerificationMethod(controller: string, verificationMethodId: string): Promise<void>;\n\n\t/**\n\t * Add a service to the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to add the service to.\n\t * @param serviceId The id of the service.\n\t * @param serviceType The type of the service.\n\t * @param serviceEndpoint The endpoint for the service.\n\t * @returns The service.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\taddService(\n\t\tcontroller: string,\n\t\tdocumentId: string,\n\t\tserviceId: string,\n\t\tserviceType: string | string[],\n\t\tserviceEndpoint: string | string[]\n\t): Promise<IDidService>;\n\n\t/**\n\t * Remove a service from the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param serviceId The id of the service.\n\t * @returns Nothing.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tremoveService(controller: string, serviceId: string): Promise<void>;\n\n\t/**\n\t * Add an alias to the alsoKnownAs property on the document.\n\t * If the alias is already present the operation is a no-op.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to add. Must be a Url or Urn (typically another DID).\n\t * @returns Nothing.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\taddAlsoKnownAs(controller: string, documentId: string, alias: string): Promise<void>;\n\n\t/**\n\t * Remove an alias from the alsoKnownAs property on the document.\n\t * If the alias is not present the operation is a no-op.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to remove. Must be a Url or Urn.\n\t * @returns Nothing.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tremoveAlsoKnownAs(controller: string, documentId: string, alias: string): Promise<void>;\n\n\t/**\n\t * Create a verifiable credential for a verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param id The id of the credential.\n\t * @param subject The credential subject to store in the verifiable credential.\n\t * @param options Additional options for creating the verifiable credential.\n\t * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t * @param options.expirationDate The date the verifiable credential is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable credential in jwt format.\n\t * @param options.jwtPayloadFields\tAdditional fields to include in the JWT payload when creating the verifiable credential in jwt format.\n\t * @returns The created verifiable credential and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tcreateVerifiableCredential(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tid: string | undefined,\n\t\tsubject: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\trevocationIndex?: number;\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t}\n\t): Promise<{\n\t\tverifiableCredential: IDidVerifiableCredential;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Check a verifiable credential is valid.\n\t * @param credential The credential to verify.\n\t * @returns The credential stored in the jwt and the revocation status.\n\t */\n\tcheckVerifiableCredential(credential: string | IDidVerifiableCredential): Promise<{\n\t\trevoked: boolean;\n\t\tverifiableCredential?: IDidVerifiableCredential;\n\t}>;\n\n\t/**\n\t * Revoke verifiable credential(s).\n\t * @param controller The controller of the identity who can make changes.\n\t * @param issuerDocumentId The id of the document to update the revocation list for.\n\t * @param credentialIndices The revocation bitmap index or indices to revoke.\n\t * @returns Nothing.\n\t */\n\trevokeVerifiableCredentials(\n\t\tcontroller: string,\n\t\tissuerDocumentId: string,\n\t\tcredentialIndices: number[]\n\t): Promise<void>;\n\n\t/**\n\t * Unrevoke verifiable credential(s).\n\t * @param controller The controller of the identity who can make changes.\n\t * @param issuerDocumentId The id of the document to update the revocation list for.\n\t * @param credentialIndices The revocation bitmap index or indices to un revoke.\n\t * @returns Nothing.\n\t */\n\tunrevokeVerifiableCredentials(\n\t\tcontroller: string,\n\t\tissuerDocumentId: string,\n\t\tcredentialIndices: number[]\n\t): Promise<void>;\n\n\t/**\n\t * Create a verifiable presentation from the supplied verifiable credentials.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The method to associate with the presentation.\n\t * @param presentationId The id of the presentation.\n\t * @param contexts The contexts for the data stored in the verifiable credential.\n\t * @param types The types for the data stored in the verifiable credential.\n\t * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.\n\t * @param options Additional options for creating the verifiable presentation.\n\t * @param options.expirationDate The date the verifiable presentation is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable presentation in jwt format.\n\t * @param options.jwtPayloadFields Additional fields to include in the JWT payload when creating the verifiable presentation in jwt format.\n\t * @returns The created verifiable presentation and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tcreateVerifiablePresentation(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tpresentationId: string | undefined,\n\t\tcontexts: IJsonLdContextDefinitionRoot | undefined,\n\t\ttypes: string | string[] | undefined,\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[],\n\t\toptions?: {\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t}\n\t): Promise<{\n\t\tverifiablePresentation: IDidVerifiablePresentation;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Check a verifiable presentation is valid.\n\t * @param presentation The presentation to verify.\n\t * @returns The presentation stored in the jwt and the revocation status.\n\t */\n\tcheckVerifiablePresentation(presentation: string | IDidVerifiablePresentation): Promise<{\n\t\trevoked: boolean;\n\t\tverifiablePresentation?: IDidVerifiablePresentation;\n\t\tissuers?: IDidDocument[];\n\t}>;\n\n\t/**\n\t * Create a proof for arbitrary data with the specified verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param proofType The type of proof to create.\n\t * @param unsecureDocument The unsecure document to create the proof for.\n\t * @returns The proof.\n\t */\n\tcreateProof(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tproofType: ProofTypes,\n\t\tunsecureDocument: IJsonLdNodeObject\n\t): Promise<IProof>;\n\n\t/**\n\t * Verify proof for arbitrary data with the specified verification method.\n\t * @param document The document to verify.\n\t * @param proof The proof to verify.\n\t * @returns True if the proof is verified.\n\t */\n\tverifyProof(document: IJsonLdNodeObject, proof: IProof): Promise<boolean>;\n}\n"]}
1
+ {"version":3,"file":"IIdentityConnector.js","sourceRoot":"","sources":["../../../src/models/IIdentityConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdContextDefinitionRoot, IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport type {\n\tDidVerificationMethodType,\n\tIDidDocument,\n\tIDidDocumentVerificationMethod,\n\tIProof,\n\tIDidService,\n\tIDidVerifiableCredential,\n\tIDidVerifiablePresentation,\n\tProofTypes\n} from \"@twin.org/standards-w3c-did\";\n\n/**\n * Interface describing an identity connector.\n */\nexport interface IIdentityConnector extends IComponent {\n\t/**\n\t * Create a new document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @returns The created document.\n\t */\n\tcreateDocument(controller: string): Promise<IDidDocument>;\n\n\t/**\n\t * Remove a document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to remove.\n\t * @returns A promise that resolves when the document has been removed.\n\t */\n\tremoveDocument(controller: string, documentId: string): Promise<void>;\n\n\t/**\n\t * Add a verification method to the document in JSON Web key Format.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to add the verification method to.\n\t * @param verificationMethodType The type of the verification method to add.\n\t * @param verificationMethodId The id of the verification method, if undefined uses the kid of the generated JWK.\n\t * @returns The verification method.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple keys.\n\t */\n\taddVerificationMethod(\n\t\tcontroller: string,\n\t\tdocumentId: string,\n\t\tverificationMethodType: DidVerificationMethodType,\n\t\tverificationMethodId?: string\n\t): Promise<IDidDocumentVerificationMethod>;\n\n\t/**\n\t * Remove a verification method from the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The id of the verification method.\n\t * @returns A promise that resolves when the verification method has been removed.\n\t * @throws NotFoundError if the id can not be resolved.\n\t * @throws NotSupportedError if the platform does not support multiple revocable keys.\n\t */\n\tremoveVerificationMethod(controller: string, verificationMethodId: string): Promise<void>;\n\n\t/**\n\t * Add a service to the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to add the service to.\n\t * @param serviceId The id of the service.\n\t * @param serviceType The type of the service.\n\t * @param serviceEndpoint The endpoint for the service.\n\t * @returns The service.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\taddService(\n\t\tcontroller: string,\n\t\tdocumentId: string,\n\t\tserviceId: string,\n\t\tserviceType: string | string[],\n\t\tserviceEndpoint: string | string[]\n\t): Promise<IDidService>;\n\n\t/**\n\t * Remove a service from the document.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param serviceId The id of the service.\n\t * @returns A promise that resolves when the service has been removed.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tremoveService(controller: string, serviceId: string): Promise<void>;\n\n\t/**\n\t * Add an alias to the alsoKnownAs property on the document.\n\t * If the alias is already present the operation is a no-op.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to add. Must be a Url or Urn (typically another DID).\n\t * @returns A promise that resolves when the alias has been added.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\taddAlsoKnownAs(controller: string, documentId: string, alias: string): Promise<void>;\n\n\t/**\n\t * Remove an alias from the alsoKnownAs property on the document.\n\t * If the alias is not present the operation is a no-op.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param documentId The id of the document to update.\n\t * @param alias The alias to remove. Must be a Url or Urn.\n\t * @returns A promise that resolves when the alias has been removed.\n\t * @throws GeneralError if the alias is not a Url or Urn.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tremoveAlsoKnownAs(controller: string, documentId: string, alias: string): Promise<void>;\n\n\t/**\n\t * Create a verifiable credential for a verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param id The id of the credential.\n\t * @param subject The credential subject to store in the verifiable credential.\n\t * @param options Additional options for creating the verifiable credential.\n\t * @param options.revocationIndex The bitmap revocation index of the credential, if undefined will not have revocation status.\n\t * @param options.expirationDate The date the verifiable credential is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable credential in jwt format.\n\t * @param options.jwtPayloadFields\tAdditional fields to include in the JWT payload when creating the verifiable credential in jwt format.\n\t * @returns The created verifiable credential and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tcreateVerifiableCredential(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tid: string | undefined,\n\t\tsubject: IJsonLdNodeObject,\n\t\toptions?: {\n\t\t\trevocationIndex?: number;\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t}\n\t): Promise<{\n\t\tverifiableCredential: IDidVerifiableCredential;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Check a verifiable credential is valid.\n\t * @param credential The credential to verify.\n\t * @returns The credential stored in the jwt and the revocation status.\n\t */\n\tcheckVerifiableCredential(credential: string | IDidVerifiableCredential): Promise<{\n\t\trevoked: boolean;\n\t\tverifiableCredential?: IDidVerifiableCredential;\n\t}>;\n\n\t/**\n\t * Revoke verifiable credential(s).\n\t * @param controller The controller of the identity who can make changes.\n\t * @param issuerDocumentId The id of the document to update the revocation list for.\n\t * @param credentialIndices The revocation bitmap index or indices to revoke.\n\t * @returns A promise that resolves when the credentials have been revoked.\n\t */\n\trevokeVerifiableCredentials(\n\t\tcontroller: string,\n\t\tissuerDocumentId: string,\n\t\tcredentialIndices: number[]\n\t): Promise<void>;\n\n\t/**\n\t * Unrevoke verifiable credential(s).\n\t * @param controller The controller of the identity who can make changes.\n\t * @param issuerDocumentId The id of the document to update the revocation list for.\n\t * @param credentialIndices The revocation bitmap index or indices to unrevoke.\n\t * @returns A promise that resolves when the credentials have been unrevoked.\n\t */\n\tunrevokeVerifiableCredentials(\n\t\tcontroller: string,\n\t\tissuerDocumentId: string,\n\t\tcredentialIndices: number[]\n\t): Promise<void>;\n\n\t/**\n\t * Create a verifiable presentation from the supplied verifiable credentials.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The method to associate with the presentation.\n\t * @param presentationId The id of the presentation.\n\t * @param contexts The contexts for the data stored in the verifiable credential.\n\t * @param types The types for the data stored in the verifiable credential.\n\t * @param verifiableCredentials The credentials to use for creating the presentation in jwt format.\n\t * @param options Additional options for creating the verifiable presentation.\n\t * @param options.expirationDate The date the verifiable presentation is valid until.\n\t * @param options.jwtHeaderFields Additional fields to include in the JWT header when creating the verifiable presentation in jwt format.\n\t * @param options.jwtPayloadFields Additional fields to include in the JWT payload when creating the verifiable presentation in jwt format.\n\t * @returns The created verifiable presentation and its token.\n\t * @throws NotFoundError if the id can not be resolved.\n\t */\n\tcreateVerifiablePresentation(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tpresentationId: string | undefined,\n\t\tcontexts: IJsonLdContextDefinitionRoot | undefined,\n\t\ttypes: string | string[] | undefined,\n\t\tverifiableCredentials: (string | IDidVerifiableCredential)[],\n\t\toptions?: {\n\t\t\texpirationDate?: Date;\n\t\t\tjwtHeaderFields?: { [id: string]: string };\n\t\t\tjwtPayloadFields?: { [id: string]: string };\n\t\t}\n\t): Promise<{\n\t\tverifiablePresentation: IDidVerifiablePresentation;\n\t\tjwt: string;\n\t}>;\n\n\t/**\n\t * Check a verifiable presentation is valid.\n\t * @param presentation The presentation to verify.\n\t * @returns The presentation stored in the jwt and the revocation status.\n\t */\n\tcheckVerifiablePresentation(presentation: string | IDidVerifiablePresentation): Promise<{\n\t\trevoked: boolean;\n\t\tverifiablePresentation?: IDidVerifiablePresentation;\n\t\tissuers?: IDidDocument[];\n\t}>;\n\n\t/**\n\t * Create a proof for arbitrary data with the specified verification method.\n\t * @param controller The controller of the identity who can make changes.\n\t * @param verificationMethodId The verification method id to use.\n\t * @param proofType The type of proof to create.\n\t * @param unsecureDocument The unsecure document to create the proof for.\n\t * @returns The proof.\n\t */\n\tcreateProof(\n\t\tcontroller: string,\n\t\tverificationMethodId: string,\n\t\tproofType: ProofTypes,\n\t\tunsecureDocument: IJsonLdNodeObject\n\t): Promise<IProof>;\n\n\t/**\n\t * Verify proof for arbitrary data with the specified verification method.\n\t * @param document The document to verify.\n\t * @param proof The proof to verify.\n\t * @returns True if the proof is verified.\n\t */\n\tverifyProof(document: IJsonLdNodeObject, proof: IProof): Promise<boolean>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IIdentityProfileComponent.js","sourceRoot":"","sources":["../../../src/models/IIdentityProfileComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a contract which provides profile operations.\n */\nexport interface IIdentityProfileComponent<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> extends IComponent {\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns Nothing.\n\t */\n\tcreate(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;\n\n\t/**\n\t * Get the profile properties for an identity.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns The items identity and the properties.\n\t */\n\tget(\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[],\n\t\tidentity?: string\n\t): Promise<{\n\t\tidentity: string;\n\t\tpublicProfile?: Partial<T>;\n\t\tprivateProfile?: Partial<U>;\n\t}>;\n\n\t/**\n\t * Get the public profile properties for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @param propertyNames The public properties to get for the profile, defaults to all.\n\t * @returns The items properties.\n\t */\n\tgetPublic(identity: string, propertyNames?: (keyof T)[]): Promise<Partial<T>>;\n\n\t/**\n\t * Update the profile properties of an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns Nothing.\n\t */\n\tupdate(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;\n\n\t/**\n\t * Delete the profile for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns Nothing.\n\t */\n\tremove(identity?: string): Promise<void>;\n\n\t/**\n\t * Get a list of the requested identities.\n\t * @param publicFilters The filters to apply to the identities public profiles.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param cursor The cursor for paged requests.\n\t * @param limit The maximum number of items in a page.\n\t * @returns The list of items and cursor for paging.\n\t */\n\tlist(\n\t\tpublicFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The identities.\n\t\t */\n\t\titems: {\n\t\t\tidentity: string;\n\t\t\tpublicProfile?: Partial<T>;\n\t\t}[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}>;\n}\n"]}
1
+ {"version":3,"file":"IIdentityProfileComponent.js","sourceRoot":"","sources":["../../../src/models/IIdentityProfileComponent.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a contract which provides profile operations.\n */\nexport interface IIdentityProfileComponent<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> extends IComponent {\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been created.\n\t */\n\tcreate(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;\n\n\t/**\n\t * Get the profile properties for an identity.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns The items identity and the properties.\n\t */\n\tget(\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[],\n\t\tidentity?: string\n\t): Promise<{\n\t\tidentity: string;\n\t\tpublicProfile?: Partial<T>;\n\t\tprivateProfile?: Partial<U>;\n\t}>;\n\n\t/**\n\t * Get the public profile properties for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @param propertyNames The public properties to get for the profile, defaults to all.\n\t * @returns The items properties.\n\t */\n\tgetPublic(identity: string, propertyNames?: (keyof T)[]): Promise<Partial<T>>;\n\n\t/**\n\t * Update the profile properties of an identity.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been updated.\n\t */\n\tupdate(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;\n\n\t/**\n\t * Delete the profile for an identity.\n\t * @param identity The identity to perform the profile operation on.\n\t * @returns A promise that resolves when the profile has been removed.\n\t */\n\tremove(identity?: string): Promise<void>;\n\n\t/**\n\t * Get a list of the requested identities.\n\t * @param publicFilters The filters to apply to the identities public profiles.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param cursor The cursor for paged requests.\n\t * @param limit The maximum number of items in a page.\n\t * @returns The list of items and cursor for paging.\n\t */\n\tlist(\n\t\tpublicFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The identities.\n\t\t */\n\t\titems: {\n\t\t\tidentity: string;\n\t\t\tpublicProfile?: Partial<T>;\n\t\t}[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"IIdentityProfileConnector.js","sourceRoot":"","sources":["../../../src/models/IIdentityProfileConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a contract which provides profile operations.\n */\nexport interface IIdentityProfileConnector<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> extends IComponent {\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param identity The identity of the profile to create.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @returns Nothing.\n\t */\n\tcreate(identity: string, publicProfile?: T, privateProfile?: U): Promise<void>;\n\n\t/**\n\t * Get the profile properties for an identity.\n\t * @param identity The identity of the item to get.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @returns The identity profile, will only return private data if you have correct permissions.\n\t */\n\tget(\n\t\tidentity: string,\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[]\n\t): Promise<{\n\t\tpublicProfile: Partial<T>;\n\t\tprivateProfile: Partial<U>;\n\t}>;\n\n\t/**\n\t * Update the profile properties of an identity.\n\t * @param identity The identity to update.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @returns Nothing.\n\t */\n\tupdate(identity: string, publicProfile?: T, privateProfile?: U): Promise<void>;\n\n\t/**\n\t * Delete the profile for an identity.\n\t * @param identity The identity to delete.\n\t * @returns Nothing.\n\t */\n\tremove(identity: string): Promise<void>;\n\n\t/**\n\t * Get a list of the requested identities.\n\t * @param publicFilters The filters to apply to the identities public profiles.\n\t * @param privateFilters The filters to apply to the identities private profiles.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @param cursor The cursor for paged requests.\n\t * @param limit The maximum number of items in a page.\n\t * @returns The list of items and cursor for paging.\n\t */\n\tlist(\n\t\tpublicFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tprivateFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The identity profiles.\n\t\t */\n\t\titems: {\n\t\t\tidentity: string;\n\t\t\tpublicProfile?: Partial<T>;\n\t\t\tprivateProfile?: Partial<U>;\n\t\t}[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}>;\n}\n"]}
1
+ {"version":3,"file":"IIdentityProfileConnector.js","sourceRoot":"","sources":["../../../src/models/IIdentityProfileConnector.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IJsonLdDocument } from \"@twin.org/data-json-ld\";\n\n/**\n * Interface describing a contract which provides profile operations.\n */\nexport interface IIdentityProfileConnector<\n\tT extends IJsonLdDocument = IJsonLdDocument,\n\tU extends IJsonLdDocument = IJsonLdDocument\n> extends IComponent {\n\t/**\n\t * Create the profile properties for an identity.\n\t * @param identity The identity of the profile to create.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @returns A promise that resolves when the profile has been created.\n\t */\n\tcreate(identity: string, publicProfile?: T, privateProfile?: U): Promise<void>;\n\n\t/**\n\t * Get the profile properties for an identity.\n\t * @param identity The identity of the item to get.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @returns The identity profile, will only return private data if you have correct permissions.\n\t */\n\tget(\n\t\tidentity: string,\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[]\n\t): Promise<{\n\t\tpublicProfile: Partial<T>;\n\t\tprivateProfile: Partial<U>;\n\t}>;\n\n\t/**\n\t * Update the profile properties of an identity.\n\t * @param identity The identity to update.\n\t * @param publicProfile The public profile data as JSON-LD.\n\t * @param privateProfile The private profile data as JSON-LD.\n\t * @returns A promise that resolves when the profile has been updated.\n\t */\n\tupdate(identity: string, publicProfile?: T, privateProfile?: U): Promise<void>;\n\n\t/**\n\t * Delete the profile for an identity.\n\t * @param identity The identity to delete.\n\t * @returns A promise that resolves when the profile has been removed.\n\t */\n\tremove(identity: string): Promise<void>;\n\n\t/**\n\t * Get a list of the requested identities.\n\t * @param publicFilters The filters to apply to the identities public profiles.\n\t * @param privateFilters The filters to apply to the identities private profiles.\n\t * @param publicPropertyNames The public properties to get for the profile, defaults to all.\n\t * @param privatePropertyNames The private properties to get for the profile, defaults to all.\n\t * @param cursor The cursor for paged requests.\n\t * @param limit The maximum number of items in a page.\n\t * @returns The list of items and cursor for paging.\n\t */\n\tlist(\n\t\tpublicFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tprivateFilters?: {\n\t\t\tpropertyName: string;\n\t\t\tpropertyValue: unknown;\n\t\t}[],\n\t\tpublicPropertyNames?: (keyof T)[],\n\t\tprivatePropertyNames?: (keyof U)[],\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The identity profiles.\n\t\t */\n\t\titems: {\n\t\t\tidentity: string;\n\t\t\tpublicProfile?: Partial<T>;\n\t\t\tprivateProfile?: Partial<U>;\n\t\t}[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"identityMetricIds.js","sourceRoot":"","sources":["../../../src/models/identityMetricIds.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,UAAU,EAAE,sBAAsB;IAElC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,qBAAqB,EAAE,kCAAkC;IAEzD;;OAEG;IACH,UAAU,EAAE,sBAAsB;IAElC;;OAEG;IACH,YAAY,EAAE,wBAAwB;IAEtC;;OAEG;IACH,UAAU,EAAE,sBAAsB;IAElC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,qBAAqB,EAAE,kCAAkC;CAChD,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Metric IDs for the identity service.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdentityMetricIds = {\n\t/**\n\t * Number of DIDs created.\n\t */\n\tDidsCreated: \"identity_dids_created\",\n\n\t/**\n\t * Number of DIDs removed.\n\t */\n\tDidsRemoved: \"identity_dids_removed\",\n\n\t/**\n\t * Number of verifiable credentials created.\n\t */\n\tVcsCreated: \"identity_vcs_created\",\n\n\t/**\n\t * Number of VC verifications succeeded.\n\t */\n\tVcsVerified: \"identity_vcs_verified\",\n\n\t/**\n\t * Number of VC verifications failed.\n\t */\n\tVcsVerificationFailed: \"identity_vcs_verification_failed\",\n\n\t/**\n\t * Number of VCs revoked.\n\t */\n\tVcsRevoked: \"identity_vcs_revoked\",\n\n\t/**\n\t * Number of VCs unrevoked.\n\t */\n\tVcsUnrevoked: \"identity_vcs_unrevoked\",\n\n\t/**\n\t * Number of verifiable presentations created.\n\t */\n\tVpsCreated: \"identity_vps_created\",\n\n\t/**\n\t * Number of VP verifications succeeded.\n\t */\n\tVpsVerified: \"identity_vps_verified\",\n\n\t/**\n\t * Number of VP verifications failed.\n\t */\n\tVpsVerificationFailed: \"identity_vps_verification_failed\"\n} as const;\n\n/**\n * Metric IDs for the identity service.\n */\nexport type IdentityMetricIds = (typeof IdentityMetricIds)[keyof typeof IdentityMetricIds];\n"]}
1
+ {"version":3,"file":"identityMetricIds.js","sourceRoot":"","sources":["../../../src/models/identityMetricIds.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AAEvC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAChC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,UAAU,EAAE,sBAAsB;IAElC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,qBAAqB,EAAE,kCAAkC;IAEzD;;OAEG;IACH,UAAU,EAAE,sBAAsB;IAElC;;OAEG;IACH,YAAY,EAAE,wBAAwB;IAEtC;;OAEG;IACH,UAAU,EAAE,sBAAsB;IAElC;;OAEG;IACH,WAAW,EAAE,uBAAuB;IAEpC;;OAEG;IACH,qBAAqB,EAAE,kCAAkC;CAChD,CAAC","sourcesContent":["// Copyright 2026 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Metric IDs for the identity service.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const IdentityMetricIds = {\n\t/**\n\t * Number of DIDs created.\n\t */\n\tDidsCreated: \"identity_dids_created\",\n\n\t/**\n\t * Number of DIDs removed.\n\t */\n\tDidsRemoved: \"identity_dids_removed\",\n\n\t/**\n\t * Number of verifiable credentials created.\n\t */\n\tVcsCreated: \"identity_vcs_created\",\n\n\t/**\n\t * Number of VC verifications succeeded.\n\t */\n\tVcsVerified: \"identity_vcs_verified\",\n\n\t/**\n\t * Number of VC verifications failed.\n\t */\n\tVcsVerificationFailed: \"identity_vcs_verification_failed\",\n\n\t/**\n\t * Number of VCs revoked.\n\t */\n\tVcsRevoked: \"identity_vcs_revoked\",\n\n\t/**\n\t * Number of VCs unrevoked.\n\t */\n\tVcsUnrevoked: \"identity_vcs_unrevoked\",\n\n\t/**\n\t * Number of verifiable presentations created.\n\t */\n\tVpsCreated: \"identity_vps_created\",\n\n\t/**\n\t * Number of VP verifications succeeded.\n\t */\n\tVpsVerified: \"identity_vps_verified\",\n\n\t/**\n\t * Number of VP verifications failed.\n\t */\n\tVpsVerificationFailed: \"identity_vps_verification_failed\"\n} as const;\n\n/**\n * Union type of all identity service metric ID string values.\n */\nexport type IdentityMetricIds = (typeof IdentityMetricIds)[keyof typeof IdentityMetricIds];\n"]}
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0.
3
3
  import { GuardError, Urn } from "@twin.org/core";
4
4
  /**
5
- * Helper methods for Ids.
5
+ * Helper methods for parsing and validating DID identifiers.
6
6
  */
7
7
  export class Did {
8
8
  /**
@@ -10,7 +10,7 @@ export class Did {
10
10
  */
11
11
  static CLASS_NAME = "Did";
12
12
  /**
13
- * Parse and id in to it's constituent parts.
13
+ * Parse an id into its constituent parts.
14
14
  * @param id The id to parse.
15
15
  * @returns The parsed id.
16
16
  * @throws GeneralError if the id is not valid.
@@ -35,7 +35,7 @@ export class Did {
35
35
  * Guard a string as a DID.
36
36
  * @param source The source of the error.
37
37
  * @param property The name of the property.
38
- * @param value The urn to parse.
38
+ * @param value The value to assert as a valid DID.
39
39
  * @throws GuardError If the value does not match the assertion.
40
40
  */
41
41
  static guard(source, property, value) {
@@ -1 +1 @@
1
- {"version":3,"file":"did.js","sourceRoot":"","sources":["../../../src/types/did.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;GAEG;AACH,MAAM,OAAO,GAAG;IACf;;OAEG;IACI,MAAM,CAAU,UAAU,SAAyB;IAE1D;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,EAAU;QAK7B,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAE1C,MAAM,MAAM,GAAG,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAEhC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;gBACN,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACnB,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;aACf,CAAC;QACH,CAAC;QACD,OAAO;YACN,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;YACnB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YACpB,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,MAAc,EAAE,QAAgB,EAAE,KAAc;QACnE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAChD,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;QAE1B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,sBAAsB,WAAiB,KAAK,CAAC,CAAC;QACpF,CAAC;QAED,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;YACxB,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,uBAAuB,WAAiB,KAAK,CAAC,CAAC;QACrF,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GuardError, Urn } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Helper methods for Ids.\n */\nexport class Did {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<Did>();\n\n\t/**\n\t * Parse and id in to it's constituent parts.\n\t * @param id The id to parse.\n\t * @returns The parsed id.\n\t * @throws GeneralError if the id is not valid.\n\t */\n\tpublic static parse(id: string): {\n\t\tmethod: string;\n\t\tnetwork?: string | undefined;\n\t\tid: string;\n\t} {\n\t\tDid.guard(Did.CLASS_NAME, nameof(id), id);\n\n\t\tconst didUrn = Urn.fromValidString(id);\n\t\tconst didParts = didUrn.parts();\n\n\t\tif (didParts.length === 3) {\n\t\t\treturn {\n\t\t\t\tmethod: didParts[1],\n\t\t\t\tid: didParts[2]\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tmethod: didParts[1],\n\t\t\tnetwork: didParts[2],\n\t\t\tid: didParts[didParts.length - 1]\n\t\t};\n\t}\n\n\t/**\n\t * Guard a string as a DID.\n\t * @param source The source of the error.\n\t * @param property The name of the property.\n\t * @param value The urn to parse.\n\t * @throws GuardError If the value does not match the assertion.\n\t */\n\tpublic static guard(source: string, property: string, value: unknown): asserts value is string {\n\t\tUrn.guard(Did.CLASS_NAME, nameof(value), value);\n\t\tconst urn = Urn.fromValidString(value);\n\t\tconst parts = urn.parts();\n\n\t\tif (parts.length < 3) {\n\t\t\tthrow new GuardError(Did.CLASS_NAME, \"guard.didPartsTooFew\", nameof(value), value);\n\t\t}\n\n\t\tif (parts[0] !== \"did\") {\n\t\t\tthrow new GuardError(Did.CLASS_NAME, \"guard.didInvalidStart\", nameof(value), value);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"did.js","sourceRoot":"","sources":["../../../src/types/did.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAGjD;;GAEG;AACH,MAAM,OAAO,GAAG;IACf;;OAEG;IACI,MAAM,CAAU,UAAU,SAAyB;IAE1D;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,EAAU;QAK7B,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,QAAc,EAAE,CAAC,CAAC;QAE1C,MAAM,MAAM,GAAG,GAAG,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAEhC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,OAAO;gBACN,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACnB,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;aACf,CAAC;QACH,CAAC;QACD,OAAO;YACN,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;YACnB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;YACpB,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;SACjC,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAC,MAAc,EAAE,QAAgB,EAAE,KAAc;QACnE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,WAAiB,KAAK,CAAC,CAAC;QAChD,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC;QAE1B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,sBAAsB,WAAiB,KAAK,CAAC,CAAC;QACpF,CAAC;QAED,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC;YACxB,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,uBAAuB,WAAiB,KAAK,CAAC,CAAC;QACrF,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GuardError, Urn } from \"@twin.org/core\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Helper methods for parsing and validating DID identifiers.\n */\nexport class Did {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<Did>();\n\n\t/**\n\t * Parse an id into its constituent parts.\n\t * @param id The id to parse.\n\t * @returns The parsed id.\n\t * @throws GeneralError if the id is not valid.\n\t */\n\tpublic static parse(id: string): {\n\t\tmethod: string;\n\t\tnetwork?: string | undefined;\n\t\tid: string;\n\t} {\n\t\tDid.guard(Did.CLASS_NAME, nameof(id), id);\n\n\t\tconst didUrn = Urn.fromValidString(id);\n\t\tconst didParts = didUrn.parts();\n\n\t\tif (didParts.length === 3) {\n\t\t\treturn {\n\t\t\t\tmethod: didParts[1],\n\t\t\t\tid: didParts[2]\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tmethod: didParts[1],\n\t\t\tnetwork: didParts[2],\n\t\t\tid: didParts[didParts.length - 1]\n\t\t};\n\t}\n\n\t/**\n\t * Guard a string as a DID.\n\t * @param source The source of the error.\n\t * @param property The name of the property.\n\t * @param value The value to assert as a valid DID.\n\t * @throws GuardError If the value does not match the assertion.\n\t */\n\tpublic static guard(source: string, property: string, value: unknown): asserts value is string {\n\t\tUrn.guard(Did.CLASS_NAME, nameof(value), value);\n\t\tconst urn = Urn.fromValidString(value);\n\t\tconst parts = urn.parts();\n\n\t\tif (parts.length < 3) {\n\t\t\tthrow new GuardError(Did.CLASS_NAME, \"guard.didPartsTooFew\", nameof(value), value);\n\t\t}\n\n\t\tif (parts[0] !== \"did\") {\n\t\t\tthrow new GuardError(Did.CLASS_NAME, \"guard.didInvalidStart\", nameof(value), value);\n\t\t}\n\t}\n}\n"]}
@@ -13,10 +13,10 @@ export class VerificationHelper {
13
13
  */
14
14
  static CLASS_NAME = "VerificationHelper";
15
15
  /**
16
- * Verified the JWT.
16
+ * Verify the JWT and return the decoded header and payload.
17
17
  * @param resolver The resolver to use for finding the document.
18
18
  * @param jwt The token to verify.
19
- * @returns The decoded payload.
19
+ * @returns The decoded header and payload.
20
20
  */
21
21
  static async verifyJwt(resolver, jwt) {
22
22
  Guards.object(VerificationHelper.CLASS_NAME, "resolver", resolver);
@@ -38,10 +38,10 @@ export class VerificationHelper {
38
38
  return Jwt.verify(jwt, publicKey);
39
39
  }
40
40
  /**
41
- * Verified the proof for the document e.g. verifiable credential.
41
+ * Verify the proof for the document.
42
42
  * @param resolver The resolver to use for finding the document.
43
43
  * @param secureDocument The secure document to verify.
44
- * @returns True if the verification is successful.
44
+ * @returns True if all proofs in the document are verified successfully.
45
45
  */
46
46
  static async verifyProof(resolver, secureDocument) {
47
47
  Guards.object(VerificationHelper.CLASS_NAME, "resolver", resolver);
@@ -1 +1 @@
1
- {"version":3,"file":"verificationHelper.js","sourceRoot":"","sources":["../../../src/utils/verificationHelper.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { ProofHelper, type IDidDocument, type IProof } from \"@twin.org/standards-w3c-did\";\nimport { Jwk, Jwt, type IJwtHeader, type IJwtPayload } from \"@twin.org/web\";\nimport { DocumentHelper } from \"./documentHelper.js\";\nimport type { IIdentityResolverComponent } from \"../models/IIdentityResolverComponent.js\";\n\n/**\n * Helper methods for verification.\n */\nexport class VerificationHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerificationHelper>();\n\n\t/**\n\t * Verified the JWT.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param jwt The token to verify.\n\t * @returns The decoded payload.\n\t */\n\tpublic static async verifyJwt<T extends IJwtHeader, U extends IJwtPayload>(\n\t\tresolver: IIdentityResolverComponent,\n\t\tjwt: string\n\t): Promise<{\n\t\theader: T;\n\t\tpayload: U;\n\t}> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.string(VerificationHelper.CLASS_NAME, nameof(jwt), jwt);\n\n\t\tconst jwtDecoded = await Jwt.decode<T, U>(jwt);\n\n\t\tconst jwtHeader = jwtDecoded.header;\n\t\tconst jwtPayload = jwtDecoded.payload;\n\t\tconst jwtSignature = jwtDecoded.signature;\n\n\t\tif (!Is.object(jwtHeader) || !Is.object(jwtPayload) || !Is.uint8Array(jwtSignature)) {\n\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"jwtDecodeFailed\");\n\t\t}\n\n\t\tconst iss = jwtHeader?.iss;\n\t\tconst kid = jwtHeader?.kid;\n\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(iss), iss);\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(kid), kid);\n\n\t\tconst didDocument = await resolver.identityResolve(iss);\n\n\t\tconst jwk = DocumentHelper.getJwk(didDocument, kid);\n\n\t\tconst publicKey = await Jwk.toCryptoKey(jwk);\n\n\t\treturn Jwt.verify(jwt, publicKey);\n\t}\n\n\t/**\n\t * Verified the proof for the document e.g. verifiable credential.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param secureDocument The secure document to verify.\n\t * @returns True if the verification is successful.\n\t */\n\tpublic static async verifyProof(\n\t\tresolver: IIdentityResolverComponent,\n\t\tsecureDocument: IJsonLdNodeObject\n\t): Promise<boolean> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument),\n\t\t\tsecureDocument\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument.proof),\n\t\t\tsecureDocument.proof\n\t\t);\n\n\t\tconst proofList = Is.array<IProof>(secureDocument.proof)\n\t\t\t? secureDocument.proof\n\t\t\t: [secureDocument.proof];\n\n\t\tconst documentCache: { [key: string]: IDidDocument } = {};\n\n\t\tfor (const proof of proofList as IProof[]) {\n\t\t\tif (!Is.stringValue(proof?.verificationMethod)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tconst proofVerificationMethod = DocumentHelper.parseId(proof.verificationMethod);\n\t\t\tif (!Is.stringValue(proofVerificationMethod.fragment)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tlet document: IDidDocument;\n\n\t\t\tif (documentCache[proofVerificationMethod.id]) {\n\t\t\t\tdocument = documentCache[proofVerificationMethod.id];\n\t\t\t} else {\n\t\t\t\tdocument = await resolver.identityResolve(proofVerificationMethod.id);\n\t\t\t\tdocumentCache[proofVerificationMethod.id] = document;\n\t\t\t}\n\n\t\t\tconst verificationJwk = DocumentHelper.getJwk(document, proofVerificationMethod.id);\n\n\t\t\tconst verified = await ProofHelper.verifyProof(secureDocument, proof, verificationJwk);\n\n\t\t\tif (!verified) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
1
+ {"version":3,"file":"verificationHelper.js","sourceRoot":"","sources":["../../../src/utils/verificationHelper.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { GeneralError, Guards, Is } from \"@twin.org/core\";\nimport type { IJsonLdNodeObject } from \"@twin.org/data-json-ld\";\nimport { nameof } from \"@twin.org/nameof\";\nimport { ProofHelper, type IDidDocument, type IProof } from \"@twin.org/standards-w3c-did\";\nimport { Jwk, Jwt, type IJwtHeader, type IJwtPayload } from \"@twin.org/web\";\nimport { DocumentHelper } from \"./documentHelper.js\";\nimport type { IIdentityResolverComponent } from \"../models/IIdentityResolverComponent.js\";\n\n/**\n * Helper methods for verification.\n */\nexport class VerificationHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<VerificationHelper>();\n\n\t/**\n\t * Verify the JWT and return the decoded header and payload.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param jwt The token to verify.\n\t * @returns The decoded header and payload.\n\t */\n\tpublic static async verifyJwt<T extends IJwtHeader, U extends IJwtPayload>(\n\t\tresolver: IIdentityResolverComponent,\n\t\tjwt: string\n\t): Promise<{\n\t\theader: T;\n\t\tpayload: U;\n\t}> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.string(VerificationHelper.CLASS_NAME, nameof(jwt), jwt);\n\n\t\tconst jwtDecoded = await Jwt.decode<T, U>(jwt);\n\n\t\tconst jwtHeader = jwtDecoded.header;\n\t\tconst jwtPayload = jwtDecoded.payload;\n\t\tconst jwtSignature = jwtDecoded.signature;\n\n\t\tif (!Is.object(jwtHeader) || !Is.object(jwtPayload) || !Is.uint8Array(jwtSignature)) {\n\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"jwtDecodeFailed\");\n\t\t}\n\n\t\tconst iss = jwtHeader?.iss;\n\t\tconst kid = jwtHeader?.kid;\n\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(iss), iss);\n\t\tGuards.stringValue(VerificationHelper.CLASS_NAME, nameof(kid), kid);\n\n\t\tconst didDocument = await resolver.identityResolve(iss);\n\n\t\tconst jwk = DocumentHelper.getJwk(didDocument, kid);\n\n\t\tconst publicKey = await Jwk.toCryptoKey(jwk);\n\n\t\treturn Jwt.verify(jwt, publicKey);\n\t}\n\n\t/**\n\t * Verify the proof for the document.\n\t * @param resolver The resolver to use for finding the document.\n\t * @param secureDocument The secure document to verify.\n\t * @returns True if all proofs in the document are verified successfully.\n\t */\n\tpublic static async verifyProof(\n\t\tresolver: IIdentityResolverComponent,\n\t\tsecureDocument: IJsonLdNodeObject\n\t): Promise<boolean> {\n\t\tGuards.object<IIdentityResolverComponent>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(resolver),\n\t\t\tresolver\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument),\n\t\t\tsecureDocument\n\t\t);\n\t\tGuards.object<IJsonLdNodeObject>(\n\t\t\tVerificationHelper.CLASS_NAME,\n\t\t\tnameof(secureDocument.proof),\n\t\t\tsecureDocument.proof\n\t\t);\n\n\t\tconst proofList = Is.array<IProof>(secureDocument.proof)\n\t\t\t? secureDocument.proof\n\t\t\t: [secureDocument.proof];\n\n\t\tconst documentCache: { [key: string]: IDidDocument } = {};\n\n\t\tfor (const proof of proofList as IProof[]) {\n\t\t\tif (!Is.stringValue(proof?.verificationMethod)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tconst proofVerificationMethod = DocumentHelper.parseId(proof.verificationMethod);\n\t\t\tif (!Is.stringValue(proofVerificationMethod.fragment)) {\n\t\t\t\tthrow new GeneralError(VerificationHelper.CLASS_NAME, \"proofMissingVerificationMethod\");\n\t\t\t}\n\n\t\t\tlet document: IDidDocument;\n\n\t\t\tif (documentCache[proofVerificationMethod.id]) {\n\t\t\t\tdocument = documentCache[proofVerificationMethod.id];\n\t\t\t} else {\n\t\t\t\tdocument = await resolver.identityResolve(proofVerificationMethod.id);\n\t\t\t\tdocumentCache[proofVerificationMethod.id] = document;\n\t\t\t}\n\n\t\t\tconst verificationJwk = DocumentHelper.getJwk(document, proofVerificationMethod.id);\n\n\t\t\tconst verified = await ProofHelper.verifyProof(secureDocument, proof, verificationJwk);\n\n\t\t\tif (!verified) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { IContextIdHandler } from "@twin.org/context";
2
2
  /**
3
- * Context Id handler for testing as a DID.
3
+ * Context ID handler that treats context identifiers as DIDs.
4
4
  */
5
5
  export declare class DidContextIdHandler implements IContextIdHandler {
6
6
  /**
@@ -19,9 +19,9 @@ export declare class DidContextIdHandler implements IContextIdHandler {
19
19
  */
20
20
  short(value: string): string;
21
21
  /**
22
- * Guard the value ensuring length.
22
+ * Guard the value ensuring it is a valid DID.
23
23
  * @param value The value to guard.
24
- * @throws GeneralError if the value is too short.
24
+ * @throws GeneralError if the value is not a valid DID.
25
25
  */
26
26
  guard(value: string): void;
27
27
  }
@@ -16,7 +16,7 @@ export interface IIdentityComponent extends IComponent {
16
16
  * Remove an identity.
17
17
  * @param identity The id of the document to remove.
18
18
  * @param controller The controller of the identity who can make changes.
19
- * @returns Nothing.
19
+ * @returns A promise that resolves when the identity has been removed.
20
20
  */
21
21
  identityRemove(identity: string, controller?: string): Promise<void>;
22
22
  /**
@@ -34,7 +34,7 @@ export interface IIdentityComponent extends IComponent {
34
34
  * Remove a verification method from the document.
35
35
  * @param verificationMethodId The id of the verification method.
36
36
  * @param controller The controller of the identity who can make changes.
37
- * @returns Nothing.
37
+ * @returns A promise that resolves when the verification method has been removed.
38
38
  * @throws NotFoundError if the id can not be resolved.
39
39
  * @throws NotSupportedError if the platform does not support multiple revocable keys.
40
40
  */
@@ -54,7 +54,7 @@ export interface IIdentityComponent extends IComponent {
54
54
  * Remove a service from the document.
55
55
  * @param serviceId The id of the service.
56
56
  * @param controller The controller of the identity who can make changes.
57
- * @returns Nothing.
57
+ * @returns A promise that resolves when the service has been removed.
58
58
  * @throws NotFoundError if the id can not be resolved.
59
59
  */
60
60
  serviceRemove(serviceId: string, controller?: string): Promise<void>;
@@ -64,7 +64,7 @@ export interface IIdentityComponent extends IComponent {
64
64
  * @param documentId The id of the document to update.
65
65
  * @param alias The alias to add. Must be a Url or Urn (typically another DID).
66
66
  * @param controller The controller of the identity who can make changes.
67
- * @returns Nothing.
67
+ * @returns A promise that resolves when the alias has been added.
68
68
  * @throws GeneralError if the alias is not a Url or Urn.
69
69
  * @throws NotFoundError if the id can not be resolved.
70
70
  */
@@ -75,7 +75,7 @@ export interface IIdentityComponent extends IComponent {
75
75
  * @param documentId The id of the document to update.
76
76
  * @param alias The alias to remove. Must be a Url or Urn.
77
77
  * @param controller The controller of the identity who can make changes.
78
- * @returns Nothing.
78
+ * @returns A promise that resolves when the alias has been removed.
79
79
  * @throws GeneralError if the alias is not a Url or Urn.
80
80
  * @throws NotFoundError if the id can not be resolved.
81
81
  */
@@ -119,17 +119,17 @@ export interface IIdentityComponent extends IComponent {
119
119
  /**
120
120
  * Revoke verifiable credential.
121
121
  * @param issuerId The id of the document to update the revocation list for.
122
- * @param credentialIndex The revocation bitmap index revoke.
122
+ * @param credentialIndex The revocation bitmap index to revoke.
123
123
  * @param controller The controller of the identity who can make changes.
124
- * @returns Nothing.
124
+ * @returns A promise that resolves when the credential has been revoked.
125
125
  */
126
126
  verifiableCredentialRevoke(issuerId: string, credentialIndex: number, controller?: string): Promise<void>;
127
127
  /**
128
128
  * Unrevoke verifiable credential.
129
129
  * @param issuerId The id of the document to update the revocation list for.
130
- * @param credentialIndex The revocation bitmap index to un revoke.
130
+ * @param credentialIndex The revocation bitmap index to unrevoke.
131
131
  * @param controller The controller of the identity who can make changes.
132
- * @returns Nothing.
132
+ * @returns A promise that resolves when the credential has been unrevoked.
133
133
  */
134
134
  verifiableCredentialUnrevoke(issuerId: string, credentialIndex: number, controller?: string): Promise<void>;
135
135
  /**
@@ -15,7 +15,7 @@ export interface IIdentityConnector extends IComponent {
15
15
  * Remove a document.
16
16
  * @param controller The controller of the identity who can make changes.
17
17
  * @param documentId The id of the document to remove.
18
- * @returns Nothing.
18
+ * @returns A promise that resolves when the document has been removed.
19
19
  */
20
20
  removeDocument(controller: string, documentId: string): Promise<void>;
21
21
  /**
@@ -33,7 +33,7 @@ export interface IIdentityConnector extends IComponent {
33
33
  * Remove a verification method from the document.
34
34
  * @param controller The controller of the identity who can make changes.
35
35
  * @param verificationMethodId The id of the verification method.
36
- * @returns Nothing.
36
+ * @returns A promise that resolves when the verification method has been removed.
37
37
  * @throws NotFoundError if the id can not be resolved.
38
38
  * @throws NotSupportedError if the platform does not support multiple revocable keys.
39
39
  */
@@ -53,7 +53,7 @@ export interface IIdentityConnector extends IComponent {
53
53
  * Remove a service from the document.
54
54
  * @param controller The controller of the identity who can make changes.
55
55
  * @param serviceId The id of the service.
56
- * @returns Nothing.
56
+ * @returns A promise that resolves when the service has been removed.
57
57
  * @throws NotFoundError if the id can not be resolved.
58
58
  */
59
59
  removeService(controller: string, serviceId: string): Promise<void>;
@@ -63,7 +63,7 @@ export interface IIdentityConnector extends IComponent {
63
63
  * @param controller The controller of the identity who can make changes.
64
64
  * @param documentId The id of the document to update.
65
65
  * @param alias The alias to add. Must be a Url or Urn (typically another DID).
66
- * @returns Nothing.
66
+ * @returns A promise that resolves when the alias has been added.
67
67
  * @throws GeneralError if the alias is not a Url or Urn.
68
68
  * @throws NotFoundError if the id can not be resolved.
69
69
  */
@@ -74,7 +74,7 @@ export interface IIdentityConnector extends IComponent {
74
74
  * @param controller The controller of the identity who can make changes.
75
75
  * @param documentId The id of the document to update.
76
76
  * @param alias The alias to remove. Must be a Url or Urn.
77
- * @returns Nothing.
77
+ * @returns A promise that resolves when the alias has been removed.
78
78
  * @throws GeneralError if the alias is not a Url or Urn.
79
79
  * @throws NotFoundError if the id can not be resolved.
80
80
  */
@@ -120,15 +120,15 @@ export interface IIdentityConnector extends IComponent {
120
120
  * @param controller The controller of the identity who can make changes.
121
121
  * @param issuerDocumentId The id of the document to update the revocation list for.
122
122
  * @param credentialIndices The revocation bitmap index or indices to revoke.
123
- * @returns Nothing.
123
+ * @returns A promise that resolves when the credentials have been revoked.
124
124
  */
125
125
  revokeVerifiableCredentials(controller: string, issuerDocumentId: string, credentialIndices: number[]): Promise<void>;
126
126
  /**
127
127
  * Unrevoke verifiable credential(s).
128
128
  * @param controller The controller of the identity who can make changes.
129
129
  * @param issuerDocumentId The id of the document to update the revocation list for.
130
- * @param credentialIndices The revocation bitmap index or indices to un revoke.
131
- * @returns Nothing.
130
+ * @param credentialIndices The revocation bitmap index or indices to unrevoke.
131
+ * @returns A promise that resolves when the credentials have been unrevoked.
132
132
  */
133
133
  unrevokeVerifiableCredentials(controller: string, issuerDocumentId: string, credentialIndices: number[]): Promise<void>;
134
134
  /**
@@ -9,7 +9,7 @@ export interface IIdentityProfileComponent<T extends IJsonLdDocument = IJsonLdDo
9
9
  * @param publicProfile The public profile data as JSON-LD.
10
10
  * @param privateProfile The private profile data as JSON-LD.
11
11
  * @param identity The identity to perform the profile operation on.
12
- * @returns Nothing.
12
+ * @returns A promise that resolves when the profile has been created.
13
13
  */
14
14
  create(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;
15
15
  /**
@@ -36,13 +36,13 @@ export interface IIdentityProfileComponent<T extends IJsonLdDocument = IJsonLdDo
36
36
  * @param publicProfile The public profile data as JSON-LD.
37
37
  * @param privateProfile The private profile data as JSON-LD.
38
38
  * @param identity The identity to perform the profile operation on.
39
- * @returns Nothing.
39
+ * @returns A promise that resolves when the profile has been updated.
40
40
  */
41
41
  update(publicProfile?: T, privateProfile?: U, identity?: string): Promise<void>;
42
42
  /**
43
43
  * Delete the profile for an identity.
44
44
  * @param identity The identity to perform the profile operation on.
45
- * @returns Nothing.
45
+ * @returns A promise that resolves when the profile has been removed.
46
46
  */
47
47
  remove(identity?: string): Promise<void>;
48
48
  /**
@@ -9,7 +9,7 @@ export interface IIdentityProfileConnector<T extends IJsonLdDocument = IJsonLdDo
9
9
  * @param identity The identity of the profile to create.
10
10
  * @param publicProfile The public profile data as JSON-LD.
11
11
  * @param privateProfile The private profile data as JSON-LD.
12
- * @returns Nothing.
12
+ * @returns A promise that resolves when the profile has been created.
13
13
  */
14
14
  create(identity: string, publicProfile?: T, privateProfile?: U): Promise<void>;
15
15
  /**
@@ -28,13 +28,13 @@ export interface IIdentityProfileConnector<T extends IJsonLdDocument = IJsonLdDo
28
28
  * @param identity The identity to update.
29
29
  * @param publicProfile The public profile data as JSON-LD.
30
30
  * @param privateProfile The private profile data as JSON-LD.
31
- * @returns Nothing.
31
+ * @returns A promise that resolves when the profile has been updated.
32
32
  */
33
33
  update(identity: string, publicProfile?: T, privateProfile?: U): Promise<void>;
34
34
  /**
35
35
  * Delete the profile for an identity.
36
36
  * @param identity The identity to delete.
37
- * @returns Nothing.
37
+ * @returns A promise that resolves when the profile has been removed.
38
38
  */
39
39
  remove(identity: string): Promise<void>;
40
40
  /**
@@ -44,6 +44,6 @@ export declare const IdentityMetricIds: {
44
44
  readonly VpsVerificationFailed: "identity_vps_verification_failed";
45
45
  };
46
46
  /**
47
- * Metric IDs for the identity service.
47
+ * Union type of all identity service metric ID string values.
48
48
  */
49
49
  export type IdentityMetricIds = (typeof IdentityMetricIds)[keyof typeof IdentityMetricIds];
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Helper methods for Ids.
2
+ * Helper methods for parsing and validating DID identifiers.
3
3
  */
4
4
  export declare class Did {
5
5
  /**
@@ -7,7 +7,7 @@ export declare class Did {
7
7
  */
8
8
  static readonly CLASS_NAME: string;
9
9
  /**
10
- * Parse and id in to it's constituent parts.
10
+ * Parse an id into its constituent parts.
11
11
  * @param id The id to parse.
12
12
  * @returns The parsed id.
13
13
  * @throws GeneralError if the id is not valid.
@@ -21,7 +21,7 @@ export declare class Did {
21
21
  * Guard a string as a DID.
22
22
  * @param source The source of the error.
23
23
  * @param property The name of the property.
24
- * @param value The urn to parse.
24
+ * @param value The value to assert as a valid DID.
25
25
  * @throws GuardError If the value does not match the assertion.
26
26
  */
27
27
  static guard(source: string, property: string, value: unknown): asserts value is string;
@@ -10,20 +10,20 @@ export declare class VerificationHelper {
10
10
  */
11
11
  static readonly CLASS_NAME: string;
12
12
  /**
13
- * Verified the JWT.
13
+ * Verify the JWT and return the decoded header and payload.
14
14
  * @param resolver The resolver to use for finding the document.
15
15
  * @param jwt The token to verify.
16
- * @returns The decoded payload.
16
+ * @returns The decoded header and payload.
17
17
  */
18
18
  static verifyJwt<T extends IJwtHeader, U extends IJwtPayload>(resolver: IIdentityResolverComponent, jwt: string): Promise<{
19
19
  header: T;
20
20
  payload: U;
21
21
  }>;
22
22
  /**
23
- * Verified the proof for the document e.g. verifiable credential.
23
+ * Verify the proof for the document.
24
24
  * @param resolver The resolver to use for finding the document.
25
25
  * @param secureDocument The secure document to verify.
26
- * @returns True if the verification is successful.
26
+ * @returns True if all proofs in the document are verified successfully.
27
27
  */
28
28
  static verifyProof(resolver: IIdentityResolverComponent, secureDocument: IJsonLdNodeObject): Promise<boolean>;
29
29
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.36](https://github.com/iotaledger/twin-identity/compare/identity-models-v0.0.3-next.35...identity-models-v0.0.3-next.36) (2026-06-17)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **identity-models:** Synchronize repo versions
9
+
10
+ ## [0.0.3-next.35](https://github.com/iotaledger/twin-identity/compare/identity-models-v0.0.3-next.34...identity-models-v0.0.3-next.35) (2026-06-01)
11
+
12
+
13
+ ### Miscellaneous Chores
14
+
15
+ * **identity-models:** Synchronize repo versions
16
+
3
17
  ## [0.0.3-next.34](https://github.com/iotaledger/twin-identity/compare/identity-models-v0.0.3-next.33...identity-models-v0.0.3-next.34) (2026-06-01)
4
18
 
5
19
 
@@ -1,6 +1,6 @@
1
1
  # Class: Did
2
2
 
3
- Helper methods for Ids.
3
+ Helper methods for parsing and validating DID identifiers.
4
4
 
5
5
  ## Constructors
6
6
 
@@ -26,7 +26,7 @@ Runtime name for the class.
26
26
 
27
27
  > `static` **parse**(`id`): `object`
28
28
 
29
- Parse and id in to it's constituent parts.
29
+ Parse an id into its constituent parts.
30
30
 
31
31
  #### Parameters
32
32
 
@@ -84,7 +84,7 @@ The name of the property.
84
84
 
85
85
  `unknown`
86
86
 
87
- The urn to parse.
87
+ The value to assert as a valid DID.
88
88
 
89
89
  #### Returns
90
90
 
@@ -1,6 +1,6 @@
1
1
  # Class: DidContextIdHandler
2
2
 
3
- Context Id handler for testing as a DID.
3
+ Context ID handler that treats context identifiers as DIDs.
4
4
 
5
5
  ## Implements
6
6
 
@@ -74,7 +74,7 @@ Short form string.
74
74
 
75
75
  > **guard**(`value`): `void`
76
76
 
77
- Guard the value ensuring length.
77
+ Guard the value ensuring it is a valid DID.
78
78
 
79
79
  #### Parameters
80
80
 
@@ -90,7 +90,7 @@ The value to guard.
90
90
 
91
91
  #### Throws
92
92
 
93
- GeneralError if the value is too short.
93
+ GeneralError if the value is not a valid DID.
94
94
 
95
95
  #### Implementation of
96
96
 
@@ -26,7 +26,7 @@ Runtime name for the class.
26
26
 
27
27
  > `static` **verifyJwt**\<`T`, `U`\>(`resolver`, `jwt`): `Promise`\<\{ `header`: `T`; `payload`: `U`; \}\>
28
28
 
29
- Verified the JWT.
29
+ Verify the JWT and return the decoded header and payload.
30
30
 
31
31
  #### Type Parameters
32
32
 
@@ -56,7 +56,7 @@ The token to verify.
56
56
 
57
57
  `Promise`\<\{ `header`: `T`; `payload`: `U`; \}\>
58
58
 
59
- The decoded payload.
59
+ The decoded header and payload.
60
60
 
61
61
  ***
62
62
 
@@ -64,7 +64,7 @@ The decoded payload.
64
64
 
65
65
  > `static` **verifyProof**(`resolver`, `secureDocument`): `Promise`\<`boolean`\>
66
66
 
67
- Verified the proof for the document e.g. verifiable credential.
67
+ Verify the proof for the document.
68
68
 
69
69
  #### Parameters
70
70
 
@@ -84,4 +84,4 @@ The secure document to verify.
84
84
 
85
85
  `Promise`\<`boolean`\>
86
86
 
87
- True if the verification is successful.
87
+ True if all proofs in the document are verified successfully.
@@ -60,7 +60,7 @@ The controller of the identity who can make changes.
60
60
 
61
61
  `Promise`\<`void`\>
62
62
 
63
- Nothing.
63
+ A promise that resolves when the identity has been removed.
64
64
 
65
65
  ***
66
66
 
@@ -136,7 +136,7 @@ The controller of the identity who can make changes.
136
136
 
137
137
  `Promise`\<`void`\>
138
138
 
139
- Nothing.
139
+ A promise that resolves when the verification method has been removed.
140
140
 
141
141
  #### Throws
142
142
 
@@ -222,7 +222,7 @@ The controller of the identity who can make changes.
222
222
 
223
223
  `Promise`\<`void`\>
224
224
 
225
- Nothing.
225
+ A promise that resolves when the service has been removed.
226
226
 
227
227
  #### Throws
228
228
 
@@ -261,7 +261,7 @@ The controller of the identity who can make changes.
261
261
 
262
262
  `Promise`\<`void`\>
263
263
 
264
- Nothing.
264
+ A promise that resolves when the alias has been added.
265
265
 
266
266
  #### Throws
267
267
 
@@ -304,7 +304,7 @@ The controller of the identity who can make changes.
304
304
 
305
305
  `Promise`\<`void`\>
306
306
 
307
- Nothing.
307
+ A promise that resolves when the alias has been removed.
308
308
 
309
309
  #### Throws
310
310
 
@@ -428,7 +428,7 @@ The id of the document to update the revocation list for.
428
428
 
429
429
  `number`
430
430
 
431
- The revocation bitmap index revoke.
431
+ The revocation bitmap index to revoke.
432
432
 
433
433
  ##### controller?
434
434
 
@@ -440,7 +440,7 @@ The controller of the identity who can make changes.
440
440
 
441
441
  `Promise`\<`void`\>
442
442
 
443
- Nothing.
443
+ A promise that resolves when the credential has been revoked.
444
444
 
445
445
  ***
446
446
 
@@ -462,7 +462,7 @@ The id of the document to update the revocation list for.
462
462
 
463
463
  `number`
464
464
 
465
- The revocation bitmap index to un revoke.
465
+ The revocation bitmap index to unrevoke.
466
466
 
467
467
  ##### controller?
468
468
 
@@ -474,7 +474,7 @@ The controller of the identity who can make changes.
474
474
 
475
475
  `Promise`\<`void`\>
476
476
 
477
- Nothing.
477
+ A promise that resolves when the credential has been unrevoked.
478
478
 
479
479
  ***
480
480
 
@@ -54,7 +54,7 @@ The id of the document to remove.
54
54
 
55
55
  `Promise`\<`void`\>
56
56
 
57
- Nothing.
57
+ A promise that resolves when the document has been removed.
58
58
 
59
59
  ***
60
60
 
@@ -130,7 +130,7 @@ The id of the verification method.
130
130
 
131
131
  `Promise`\<`void`\>
132
132
 
133
- Nothing.
133
+ A promise that resolves when the verification method has been removed.
134
134
 
135
135
  #### Throws
136
136
 
@@ -216,7 +216,7 @@ The id of the service.
216
216
 
217
217
  `Promise`\<`void`\>
218
218
 
219
- Nothing.
219
+ A promise that resolves when the service has been removed.
220
220
 
221
221
  #### Throws
222
222
 
@@ -255,7 +255,7 @@ The alias to add. Must be a Url or Urn (typically another DID).
255
255
 
256
256
  `Promise`\<`void`\>
257
257
 
258
- Nothing.
258
+ A promise that resolves when the alias has been added.
259
259
 
260
260
  #### Throws
261
261
 
@@ -298,7 +298,7 @@ The alias to remove. Must be a Url or Urn.
298
298
 
299
299
  `Promise`\<`void`\>
300
300
 
301
- Nothing.
301
+ A promise that resolves when the alias has been removed.
302
302
 
303
303
  #### Throws
304
304
 
@@ -434,7 +434,7 @@ The revocation bitmap index or indices to revoke.
434
434
 
435
435
  `Promise`\<`void`\>
436
436
 
437
- Nothing.
437
+ A promise that resolves when the credentials have been revoked.
438
438
 
439
439
  ***
440
440
 
@@ -462,13 +462,13 @@ The id of the document to update the revocation list for.
462
462
 
463
463
  `number`[]
464
464
 
465
- The revocation bitmap index or indices to un revoke.
465
+ The revocation bitmap index or indices to unrevoke.
466
466
 
467
467
  #### Returns
468
468
 
469
469
  `Promise`\<`void`\>
470
470
 
471
- Nothing.
471
+ A promise that resolves when the credentials have been unrevoked.
472
472
 
473
473
  ***
474
474
 
@@ -48,7 +48,7 @@ The identity to perform the profile operation on.
48
48
 
49
49
  `Promise`\<`void`\>
50
50
 
51
- Nothing.
51
+ A promise that resolves when the profile has been created.
52
52
 
53
53
  ***
54
54
 
@@ -144,7 +144,7 @@ The identity to perform the profile operation on.
144
144
 
145
145
  `Promise`\<`void`\>
146
146
 
147
- Nothing.
147
+ A promise that resolves when the profile has been updated.
148
148
 
149
149
  ***
150
150
 
@@ -166,7 +166,7 @@ The identity to perform the profile operation on.
166
166
 
167
167
  `Promise`\<`void`\>
168
168
 
169
- Nothing.
169
+ A promise that resolves when the profile has been removed.
170
170
 
171
171
  ***
172
172
 
@@ -48,7 +48,7 @@ The private profile data as JSON-LD.
48
48
 
49
49
  `Promise`\<`void`\>
50
50
 
51
- Nothing.
51
+ A promise that resolves when the profile has been created.
52
52
 
53
53
  ***
54
54
 
@@ -116,7 +116,7 @@ The private profile data as JSON-LD.
116
116
 
117
117
  `Promise`\<`void`\>
118
118
 
119
- Nothing.
119
+ A promise that resolves when the profile has been updated.
120
120
 
121
121
  ***
122
122
 
@@ -138,7 +138,7 @@ The identity to delete.
138
138
 
139
139
  `Promise`\<`void`\>
140
140
 
141
- Nothing.
141
+ A promise that resolves when the profile has been removed.
142
142
 
143
143
  ***
144
144
 
@@ -2,4 +2,4 @@
2
2
 
3
3
  > **IdentityMetricIds** = *typeof* [`IdentityMetricIds`](../variables/IdentityMetricIds.md)\[keyof *typeof* [`IdentityMetricIds`](../variables/IdentityMetricIds.md)\]
4
4
 
5
- Metric IDs for the identity service.
5
+ Union type of all identity service metric ID string values.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/identity-models",
3
- "version": "0.0.3-next.34",
3
+ "version": "0.0.3-next.36",
4
4
  "description": "Shared identity models and contracts for consistent data structures across services, connectors, and clients.",
5
5
  "repository": {
6
6
  "type": "git",