@credo-ts/core 0.7.2-pr-2704-20260925144545 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/crypto/JwsService.mjs +2 -1
- package/build/crypto/JwsService.mjs.map +1 -1
- package/build/crypto/index.d.mts +2 -2
- package/build/index.d.mts +4 -4
- package/build/index.d.mts.map +1 -1
- package/build/index.mjs +3 -3
- package/build/index.mjs.map +1 -1
- package/build/modules/dids/domain/DidDocument.d.mts +3 -7
- package/build/modules/dids/domain/DidDocument.d.mts.map +1 -1
- package/build/modules/dids/domain/DidDocument.mjs +8 -32
- package/build/modules/dids/domain/DidDocument.mjs.map +1 -1
- package/build/modules/dids/methods/peer/peerDidNumAlgo2.d.mts +0 -1
- package/build/modules/dids/methods/peer/peerDidNumAlgo2.d.mts.map +1 -1
- package/build/modules/dids/methods/peer/peerDidNumAlgo2.mjs +1 -6
- package/build/modules/dids/methods/peer/peerDidNumAlgo2.mjs.map +1 -1
- package/build/modules/dids/methods/peer/peerDidNumAlgo4.d.mts +0 -5
- package/build/modules/dids/methods/peer/peerDidNumAlgo4.d.mts.map +1 -1
- package/build/modules/dids/methods/peer/peerDidNumAlgo4.mjs +1 -10
- package/build/modules/dids/methods/peer/peerDidNumAlgo4.mjs.map +1 -1
- package/build/modules/dids/repository/DidRecord.mjs.map +1 -1
- package/build/modules/dif-presentation-exchange/utils/credentialSelection.d.mts +1 -0
- package/build/modules/dif-presentation-exchange/utils/credentialSelection.mjs.map +1 -1
- package/build/modules/kms/jwk/PublicJwk.d.mts +1 -1
- package/build/modules/kms/jwk/PublicJwk.d.mts.map +1 -1
- package/build/modules/kms/jwk/PublicJwk.mjs +2 -3
- package/build/modules/kms/jwk/PublicJwk.mjs.map +1 -1
- package/build/modules/kms/jwk/alg/keyDerivation.d.mts.map +1 -1
- package/build/modules/kms/jwk/alg/keyDerivation.mjs +0 -3
- package/build/modules/kms/jwk/alg/keyDerivation.mjs.map +1 -1
- package/build/modules/kms/jwk/jwa.d.mts +0 -3
- package/build/modules/kms/jwk/jwa.d.mts.map +1 -1
- package/build/modules/kms/jwk/jwa.mjs +0 -2
- package/build/modules/kms/jwk/jwa.mjs.map +1 -1
- package/build/modules/kms/jwk/kty/ec/P256PublicJwk.d.mts +2 -2
- package/build/modules/kms/jwk/kty/ec/P256PublicJwk.d.mts.map +1 -1
- package/build/modules/kms/jwk/kty/ec/P256PublicJwk.mjs +1 -7
- package/build/modules/kms/jwk/kty/ec/P256PublicJwk.mjs.map +1 -1
- package/build/modules/kms/jwk/kty/okp/Ed25519PublicJwk.d.mts +1 -1
- package/build/modules/kms/jwk/kty/rsa/RsaPublicJwk.d.mts +1 -1
- package/build/modules/kms/options/KmsDecryptOptions.d.mts +0 -158
- package/build/modules/kms/options/KmsDecryptOptions.d.mts.map +1 -1
- package/build/modules/kms/options/KmsEncryptOptions.d.mts +0 -80
- package/build/modules/kms/options/KmsEncryptOptions.d.mts.map +1 -1
- package/build/modules/kms/options/KmsEncryptOptions.mjs +2 -6
- package/build/modules/kms/options/KmsEncryptOptions.mjs.map +1 -1
- package/build/modules/kms/options/KmsKeyAgreementDecryptOptions.d.mts +0 -195
- package/build/modules/kms/options/KmsKeyAgreementDecryptOptions.d.mts.map +1 -1
- package/build/modules/kms/options/KmsKeyAgreementDecryptOptions.mjs +0 -10
- package/build/modules/kms/options/KmsKeyAgreementDecryptOptions.mjs.map +1 -1
- package/build/modules/kms/options/KmsKeyAgreementEncryptOptions.d.mts +0 -43
- package/build/modules/kms/options/KmsKeyAgreementEncryptOptions.d.mts.map +1 -1
- package/build/modules/kms/options/KmsKeyAgreementEncryptOptions.mjs +0 -14
- package/build/modules/kms/options/KmsKeyAgreementEncryptOptions.mjs.map +1 -1
- package/build/modules/token-status-list/TokenStatusListSigner.d.mts +1 -1
- package/build/modules/token-status-list/TokenStatusListSigner.d.mts.map +1 -1
- package/build/modules/vc/index.d.mts +1 -2
- package/build/modules/vc/index.mjs +0 -1
- package/build/modules/vc/linked-data-proofs/models/W3cJsonLdVerifiableCredential.d.mts +1 -1
- package/build/modules/vc/linked-data-proofs/models/W3cJsonLdVerifiablePresentation.d.mts +1 -1
- package/package.json +7 -7
|
@@ -167,8 +167,9 @@ let JwsService = class JwsService {
|
|
|
167
167
|
}
|
|
168
168
|
async verifyJwsSigner(agentContext, options) {
|
|
169
169
|
const { jwsSigner } = options;
|
|
170
|
+
const x509ModuleConfig = agentContext.dependencyManager.resolve(X509ModuleConfig);
|
|
170
171
|
if (jwsSigner.method === "x5c") {
|
|
171
|
-
const trustedCertificatesFromConfig =
|
|
172
|
+
const trustedCertificatesFromConfig = x509ModuleConfig.trustedCertificates ?? [];
|
|
172
173
|
const trustedCertificates = options.trustedCertificates ?? trustedCertificatesFromConfig;
|
|
173
174
|
if (trustedCertificates.length === 0) throw new CredoError(`trustedCertificates is required when the JWS protected header contains an 'x5c' property.`);
|
|
174
175
|
const convertedTrustedCertificates = convertLegacyTrustedCertificates(trustedCertificates);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JwsService.mjs","names":[],"sources":["../../src/crypto/JwsService.ts"],"sourcesContent":["import type { AgentContext } from '../agent'\nimport { CredoError } from '../error'\nimport {\n assertJwkAsymmetric,\n asymmetricPublicJwkMatches,\n getJwkHumanDescription,\n KeyManagementApi,\n KeyManagementError,\n type KnownJwaSignatureAlgorithm,\n PublicJwk,\n} from '../modules/kms'\nimport { isKnownJwaSignatureAlgorithm } from '../modules/kms/jwk/jwa'\nimport { convertLegacyTrustedCertificates } from '../modules/x509/utils/convertLegacyTrustedCertificates'\nimport { X509ModuleConfig, type X509VerificationTrustedCertificates } from '../modules/x509/X509ModuleConfig'\nimport { X509Service } from './../modules/x509/X509Service'\nimport { type EncodedX509Certificate } from '../modules/x509/X509ServiceOptions'\nimport { injectable } from '../plugins'\nimport { isJsonObject } from '../types'\nimport { JsonEncoder, TypedArrayEncoder } from '../utils'\nimport type { JwsSigner, JwsSignerWithJwk } from './JwsSigner'\nimport type {\n Jws,\n JwsDetachedFormat,\n JwsFlattenedFormat,\n JwsGeneralFormat,\n JwsProtectedHeaderOptions,\n} from './JwsTypes'\nimport { JWS_COMPACT_FORMAT_MATCHER } from './JwsTypes'\nimport { JwtPayload } from './jose/jwt'\n\n@injectable()\nexport class JwsService {\n private async createJwsBase(agentContext: AgentContext, options: CreateJwsBaseOptions) {\n const { jwk, alg, x5c } = options.protectedHeaderOptions\n\n const kms = agentContext.dependencyManager.resolve(KeyManagementApi)\n\n const key = await kms.getPublicKey({ keyId: options.keyId })\n assertJwkAsymmetric(key)\n\n const publicJwk = PublicJwk.fromPublicJwk(key)\n\n // Make sure the options.x5c and x5c from protectedHeader are the same.\n if (x5c) {\n const certificate = X509Service.getLeafCertificate(agentContext, {\n certificateChain: x5c,\n })\n\n if (!asymmetricPublicJwkMatches(certificate.publicJwk.toJson(), key)) {\n throw new CredoError('Protected header x5c does not match key for signing.')\n }\n }\n\n const jwkInstance = jwk instanceof PublicJwk ? jwk : jwk ? PublicJwk.fromUnknown(jwk) : undefined\n // Make sure the options.key and jwk from protectedHeader are the same.\n if (jwkInstance && !asymmetricPublicJwkMatches(jwkInstance.toJson(), key)) {\n throw new CredoError('Protected header JWK does not match key for signing.')\n }\n\n // Validate the options.key used for signing against the jws options\n if (!publicJwk.supportedSignatureAlgorithms.includes(alg)) {\n throw new CredoError(\n `alg '${alg}' is not a valid JWA signature algorithm for this jwk with ${publicJwk.jwkTypeHumanDescription}. Supported algorithms are ${publicJwk.supportedSignatureAlgorithms.join(\n ', '\n )}`\n )\n }\n\n const payload =\n options.payload instanceof JwtPayload ? JsonEncoder.toUint8Array(options.payload.toJson()) : options.payload\n\n const base64Payload = TypedArrayEncoder.toBase64Url(payload)\n const base64UrlProtectedHeader = JsonEncoder.toBase64Url(this.buildProtected(options.protectedHeaderOptions))\n\n const signResult = await kms.sign({\n algorithm: alg,\n data: TypedArrayEncoder.fromUtf8String(`${base64UrlProtectedHeader}.${base64Payload}`),\n keyId: options.keyId,\n })\n const signature = TypedArrayEncoder.toBase64Url(signResult.signature)\n\n return {\n base64Payload,\n base64UrlProtectedHeader,\n signature,\n }\n }\n\n public async createJws(\n agentContext: AgentContext,\n { payload, keyId, header, protectedHeaderOptions }: CreateJwsOptions\n ): Promise<JwsGeneralFormat> {\n const { base64UrlProtectedHeader, signature, base64Payload } = await this.createJwsBase(agentContext, {\n payload,\n keyId,\n protectedHeaderOptions,\n })\n\n return {\n protected: base64UrlProtectedHeader,\n signature,\n header,\n payload: base64Payload,\n }\n }\n\n /**\n * @see {@link https://www.rfc-editor.org/rfc/rfc7515#section-3.1}\n * */\n public async createJwsCompact(\n agentContext: AgentContext,\n { payload, keyId, protectedHeaderOptions }: CreateCompactJwsOptions\n ): Promise<string> {\n const { base64Payload, base64UrlProtectedHeader, signature } = await this.createJwsBase(agentContext, {\n payload,\n keyId,\n protectedHeaderOptions,\n })\n return `${base64UrlProtectedHeader}.${base64Payload}.${signature}`\n }\n\n /**\n * Verify a JWS\n */\n public async verifyJws(\n agentContext: AgentContext,\n {\n jws,\n resolveJwsSigner,\n trustedCertificates,\n jwsSigner: expectedJwsSigner,\n allowedJwsSignerMethods = ['did', 'jwk', 'x5c'],\n }: VerifyJwsOptions\n ): Promise<VerifyJwsResult> {\n let signatures: JwsDetachedFormat[] = []\n let payload: string\n\n if (expectedJwsSigner && !allowedJwsSignerMethods.includes(expectedJwsSigner.method)) {\n throw new CredoError(\n `jwsSigner provided with method '${\n expectedJwsSigner.method\n }', but allowed jws signer methods are ${allowedJwsSignerMethods.join(', ')}.`\n )\n }\n\n if (typeof jws === 'string') {\n if (!JWS_COMPACT_FORMAT_MATCHER.test(jws)) throw new CredoError(`Invalid JWS compact format for value '${jws}'.`)\n\n const [protectedHeader, _payload, signature] = jws.split('.')\n\n payload = _payload\n signatures.push({\n header: {},\n protected: protectedHeader,\n signature,\n })\n } else if ('signatures' in jws) {\n signatures = jws.signatures\n payload = jws.payload\n } else {\n signatures.push(jws)\n payload = jws.payload\n }\n\n if (signatures.length === 0) {\n throw new CredoError('Unable to verify JWS, no signatures present in JWS.')\n }\n\n const jwsFlattened = {\n signatures,\n payload,\n } satisfies JwsFlattenedFormat\n\n const jwsSigners: JwsSignerWithJwk[] = []\n for (const jws of signatures) {\n const protectedJson = JsonEncoder.fromBase64Url(jws.protected)\n\n if (!isJsonObject(protectedJson)) {\n throw new CredoError('Unable to verify JWS, protected header is not a valid JSON object.')\n }\n\n if (!protectedJson.alg || typeof protectedJson.alg !== 'string') {\n throw new CredoError('Unable to verify JWS, protected header alg is not provided or not a string.')\n }\n\n const jwsSigner =\n expectedJwsSigner ??\n (await this.jwsSignerFromJws(agentContext, {\n jws,\n payload,\n protectedHeader: {\n ...protectedJson,\n alg: protectedJson.alg,\n },\n allowedJwsSignerMethods,\n resolveJwsSigner,\n }))\n\n await this.verifyJwsSigner(agentContext, {\n jwsSigner,\n trustedCertificates,\n })\n\n if (!jwsSigner.jwk.supportedSignatureAlgorithms.includes(protectedJson.alg as KnownJwaSignatureAlgorithm)) {\n throw new CredoError(\n `alg '${protectedJson.alg}' is not a valid JWA signature algorithm for this jwk ${getJwkHumanDescription(jwsSigner.jwk.toJson())}. Supported algorithms are ${jwsSigner.jwk.supportedSignatureAlgorithms.join(', ')}`\n )\n }\n\n const data = TypedArrayEncoder.fromUtf8String(`${jws.protected}.${payload}`)\n const signature = TypedArrayEncoder.fromBase64Url(jws.signature)\n jwsSigners.push(jwsSigner)\n\n const kms = agentContext.dependencyManager.resolve(KeyManagementApi)\n\n try {\n const { verified } = await kms.verify({\n key: {\n publicJwk: jwsSigner.jwk.toJson(),\n },\n data,\n signature,\n algorithm: protectedJson.alg as KnownJwaSignatureAlgorithm,\n })\n\n if (!verified) {\n return {\n isValid: false,\n jwsSigners: [],\n jws: jwsFlattened,\n }\n }\n } catch (error) {\n // WalletError probably means signature verification failed. Would be useful to add\n // more specific error type in kms.verify method\n if (error instanceof KeyManagementError) {\n return {\n isValid: false,\n jwsSigners: [],\n jws: jwsFlattened,\n }\n }\n\n throw error\n }\n }\n\n return { isValid: true, jwsSigners, jws: jwsFlattened }\n }\n\n private buildProtected(options: JwsProtectedHeaderOptions) {\n return {\n ...options,\n alg: options.alg,\n jwk: options.jwk instanceof PublicJwk ? options.jwk.toJson() : options.jwk,\n kid: options.kid,\n }\n }\n\n private async verifyJwsSigner(\n agentContext: AgentContext,\n options: {\n jwsSigner: JwsSignerWithJwk\n trustedCertificates?: EncodedX509Certificate[] | X509VerificationTrustedCertificates[]\n }\n ) {\n const { jwsSigner } = options\n\n if (jwsSigner.method === 'x5c') {\n const x509ModuleConfig = agentContext.dependencyManager.resolve(X509ModuleConfig)\n const trustedCertificatesFromConfig = x509ModuleConfig.trustedCertificates ?? []\n const trustedCertificates = options.trustedCertificates ?? trustedCertificatesFromConfig\n if (trustedCertificates.length === 0) {\n throw new CredoError(\n `trustedCertificates is required when the JWS protected header contains an 'x5c' property.`\n )\n }\n\n const convertedTrustedCertificates = convertLegacyTrustedCertificates(trustedCertificates)\n\n await X509Service.validateCertificateChain(agentContext, {\n certificateChain: jwsSigner.x5c,\n trustedCertificates: convertedTrustedCertificates.flatMap(({ issuance }) => issuance),\n })\n }\n }\n\n private async jwsSignerFromJws(\n agentContext: AgentContext,\n options: {\n jws: JwsDetachedFormat\n allowedJwsSignerMethods: JwsSigner['method'][]\n protectedHeader: { alg: string; [key: string]: unknown }\n payload: string\n resolveJwsSigner?: JwsSignerResolver\n }\n ): Promise<JwsSignerWithJwk> {\n const { protectedHeader, resolveJwsSigner, jws, payload, allowedJwsSignerMethods } = options\n\n const alg = protectedHeader.alg\n if (!isKnownJwaSignatureAlgorithm(alg)) {\n throw new CredoError(`Unsupported JWA signature algorithm '${protectedHeader.alg}'`)\n }\n\n if (protectedHeader.x5c && allowedJwsSignerMethods.includes('x5c')) {\n if (\n !Array.isArray(protectedHeader.x5c) ||\n protectedHeader.x5c.some((certificate) => typeof certificate !== 'string')\n ) {\n throw new CredoError('x5c header is not a valid JSON array of strings.')\n }\n\n const certificate = X509Service.getLeafCertificate(agentContext, {\n certificateChain: protectedHeader.x5c,\n })\n return {\n method: 'x5c',\n jwk: certificate.publicJwk,\n x5c: protectedHeader.x5c,\n }\n }\n\n // Jwk\n if (protectedHeader.jwk && allowedJwsSignerMethods.includes('jwk')) {\n if (!isJsonObject(protectedHeader.jwk)) throw new CredoError('JWK is not a valid JSON object.')\n\n const protectedJwk = PublicJwk.fromUnknown(protectedHeader.jwk)\n\n return {\n method: 'jwk',\n jwk: protectedJwk,\n }\n }\n\n if (!resolveJwsSigner) {\n throw new CredoError(`resolveJwsSigner is required for resolving jws signers other than 'jwk' and 'x5c'.`)\n }\n\n try {\n const jwsSigner = await resolveJwsSigner({\n jws,\n protectedHeader: {\n ...protectedHeader,\n alg,\n },\n payload,\n })\n\n if (!allowedJwsSignerMethods.includes(jwsSigner.method)) {\n throw new CredoError(\n `resolveJwsSigner returned jws signer with method '${\n jwsSigner.method\n }', but allowed jws signer methods are ${allowedJwsSignerMethods.join(', ')}.`\n )\n }\n\n return jwsSigner\n } catch (error) {\n throw new CredoError(`Error when resolving jws signer for jws in resolveJwsSigner. ${error.message}`, {\n cause: error,\n })\n }\n }\n}\n\nexport interface CreateJwsOptions {\n payload: Uint8Array | JwtPayload\n keyId: string\n header: Record<string, unknown>\n protectedHeaderOptions: JwsProtectedHeaderOptions\n}\n\ntype CreateJwsBaseOptions = Omit<CreateJwsOptions, 'header'>\ntype CreateCompactJwsOptions = Omit<CreateJwsOptions, 'header'>\n\nexport interface VerifyJwsOptions {\n jws: Jws\n\n /**\n * The expected signer of the JWS. If provided the signer won't be dynamically\n * detected based on the values in the JWS.\n */\n jwsSigner?: JwsSignerWithJwk\n\n /**\n * Allowed jws signer methods when dynamically inferring the jws signer method.\n */\n allowedJwsSignerMethods?: JwsSigner['method'][]\n\n /*\n * Method that should return the JWS signer was used\n * to sign the JWS.\n *\n * This method is called by the JWS Service when it could not determine the public key.\n *\n * Currently the JWS Service can only determine the public key if the JWS protected header\n * contains a `jwk` or `x5c` property. In all other cases, it's up to the caller to resolve the public\n * key based on the JWS.\n *\n * A common use case is the `kid` property in the JWS protected header. Or determining the key\n * base on the `iss` property in the JWT payload.\n */\n resolveJwsSigner?: JwsSignerResolver\n\n trustedCertificates?: EncodedX509Certificate[] | X509VerificationTrustedCertificates[]\n}\n\nexport type JwsSignerResolver = (options: {\n jws: JwsDetachedFormat\n payload: string\n protectedHeader: {\n alg: KnownJwaSignatureAlgorithm\n jwk?: string\n kid?: string\n [key: string]: unknown\n }\n}) => Promise<JwsSignerWithJwk> | JwsSignerWithJwk\n\nexport interface VerifyJwsResult {\n isValid: boolean\n jwsSigners: JwsSignerWithJwk[]\n\n jws: JwsFlattenedFormat\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA+BO,IAAM,aAAN,MAAM,WAAW;CACtB,MAAc,cAAc,cAA4B,SAA+B;EACrF,MAAM,EAAE,KAAK,KAAK,QAAQ,QAAQ;EAElC,MAAM,MAAM,aAAa,kBAAkB,QAAQ,gBAAgB;EAEnE,MAAM,MAAM,MAAM,IAAI,aAAa,EAAE,OAAO,QAAQ,MAAM,CAAC;EAC3D,oBAAoB,GAAG;EAEvB,MAAM,YAAY,UAAU,cAAc,GAAG;EAG7C,IAAI,KAAK;GACP,MAAM,cAAc,YAAY,mBAAmB,cAAc,EAC/D,kBAAkB,IACpB,CAAC;GAED,IAAI,CAAC,2BAA2B,YAAY,UAAU,OAAO,GAAG,GAAG,GACjE,MAAM,IAAI,WAAW,sDAAsD;EAE/E;EAEA,MAAM,cAAc,eAAe,YAAY,MAAM,MAAM,UAAU,YAAY,GAAG,IAAI,KAAA;EAExF,IAAI,eAAe,CAAC,2BAA2B,YAAY,OAAO,GAAG,GAAG,GACtE,MAAM,IAAI,WAAW,sDAAsD;EAI7E,IAAI,CAAC,UAAU,6BAA6B,SAAS,GAAG,GACtD,MAAM,IAAI,WACR,QAAQ,IAAI,6DAA6D,UA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QAAQ,GAEzE,MAAM,IAAI,WAAW,kDAAkD;GAMzE,OAAO;IACL,QAAQ;IACR,KALkB,YAAY,mBAAmB,cAAc,EAC/D,kBAAkB,gBAAgB,IACpC,CAGiB,CAAC,CAAC;IACjB,KAAK,gBAAgB;GACvB;EACF;EAGA,IAAI,gBAAgB,OAAO,wBAAwB,SAAS,KAAK,GAAG;GAClE,IAAI,CAAC,aAAa,gBAAgB,GAAG,GAAG,MAAM,IAAI,WAAW,iCAAiC;GAI9F,OAAO;IACL,QAAQ;IACR,KAJmB,UAAU,YAAY,gBAAgB,GAIzC;GAClB;EACF;EAEA,IAAI,CAAC,kBACH,MAAM,IAAI,WAAW,oFAAoF;EAG3G,IAAI;GACF,MAAM,YAAY,MAAM,iBAAiB;IACvC;IACA,iBAAiB;KACf,GAAG;KACH;IACF;IACA;GACF,CAAC;GAED,IAAI,CAAC,wBAAwB,SAAS,UAAU,MAAM,GACpD,MAAM,IAAI,WACR,qDACE,UAAU,OACX,wCAAwC,wBAAwB,KAAK,IAAI,EAAE,EAC9E;GAGF,OAAO;EACT,SAAS,OAAO;GACd,MAAM,IAAI,WAAW,gEAAgE,MAAM,WAAW,EACpG,OAAO,MACT,CAAC;EACH;CACF;AACF;AA7UC,aAAA,WAAA,CAAA,WAAW,CAAA,GAAA,UAAA"}
|
|
1
|
+
{"version":3,"file":"JwsService.mjs","names":[],"sources":["../../src/crypto/JwsService.ts"],"sourcesContent":["import type { AgentContext } from '../agent'\nimport { CredoError } from '../error'\nimport {\n assertJwkAsymmetric,\n asymmetricPublicJwkMatches,\n getJwkHumanDescription,\n KeyManagementApi,\n KeyManagementError,\n type KnownJwaSignatureAlgorithm,\n PublicJwk,\n} from '../modules/kms'\nimport { isKnownJwaSignatureAlgorithm } from '../modules/kms/jwk/jwa'\nimport { convertLegacyTrustedCertificates } from '../modules/x509/utils/convertLegacyTrustedCertificates'\nimport { X509ModuleConfig, type X509VerificationTrustedCertificates } from '../modules/x509/X509ModuleConfig'\nimport { X509Service } from './../modules/x509/X509Service'\nimport { type EncodedX509Certificate } from '../modules/x509/X509ServiceOptions'\nimport { injectable } from '../plugins'\nimport { isJsonObject } from '../types'\nimport { JsonEncoder, TypedArrayEncoder } from '../utils'\nimport type { JwsSigner, JwsSignerWithJwk } from './JwsSigner'\nimport type {\n Jws,\n JwsDetachedFormat,\n JwsFlattenedFormat,\n JwsGeneralFormat,\n JwsProtectedHeaderOptions,\n} from './JwsTypes'\nimport { JWS_COMPACT_FORMAT_MATCHER } from './JwsTypes'\nimport { JwtPayload } from './jose/jwt'\n\n@injectable()\nexport class JwsService {\n private async createJwsBase(agentContext: AgentContext, options: CreateJwsBaseOptions) {\n const { jwk, alg, x5c } = options.protectedHeaderOptions\n\n const kms = agentContext.dependencyManager.resolve(KeyManagementApi)\n\n const key = await kms.getPublicKey({ keyId: options.keyId })\n assertJwkAsymmetric(key)\n\n const publicJwk = PublicJwk.fromPublicJwk(key)\n\n // Make sure the options.x5c and x5c from protectedHeader are the same.\n if (x5c) {\n const certificate = X509Service.getLeafCertificate(agentContext, {\n certificateChain: x5c,\n })\n\n if (!asymmetricPublicJwkMatches(certificate.publicJwk.toJson(), key)) {\n throw new CredoError('Protected header x5c does not match key for signing.')\n }\n }\n\n const jwkInstance = jwk instanceof PublicJwk ? jwk : jwk ? PublicJwk.fromUnknown(jwk) : undefined\n // Make sure the options.key and jwk from protectedHeader are the same.\n if (jwkInstance && !asymmetricPublicJwkMatches(jwkInstance.toJson(), key)) {\n throw new CredoError('Protected header JWK does not match key for signing.')\n }\n\n // Validate the options.key used for signing against the jws options\n if (!publicJwk.supportedSignatureAlgorithms.includes(alg)) {\n throw new CredoError(\n `alg '${alg}' is not a valid JWA signature algorithm for this jwk with ${publicJwk.jwkTypeHumanDescription}. Supported algorithms are ${publicJwk.supportedSignatureAlgorithms.join(\n ', '\n )}`\n )\n }\n\n const payload =\n options.payload instanceof JwtPayload ? JsonEncoder.toUint8Array(options.payload.toJson()) : options.payload\n\n const base64Payload = TypedArrayEncoder.toBase64Url(payload)\n const base64UrlProtectedHeader = JsonEncoder.toBase64Url(this.buildProtected(options.protectedHeaderOptions))\n\n const signResult = await kms.sign({\n algorithm: alg,\n data: TypedArrayEncoder.fromUtf8String(`${base64UrlProtectedHeader}.${base64Payload}`),\n keyId: options.keyId,\n })\n const signature = TypedArrayEncoder.toBase64Url(signResult.signature)\n\n return {\n base64Payload,\n base64UrlProtectedHeader,\n signature,\n }\n }\n\n public async createJws(\n agentContext: AgentContext,\n { payload, keyId, header, protectedHeaderOptions }: CreateJwsOptions\n ): Promise<JwsGeneralFormat> {\n const { base64UrlProtectedHeader, signature, base64Payload } = await this.createJwsBase(agentContext, {\n payload,\n keyId,\n protectedHeaderOptions,\n })\n\n return {\n protected: base64UrlProtectedHeader,\n signature,\n header,\n payload: base64Payload,\n }\n }\n\n /**\n * @see {@link https://www.rfc-editor.org/rfc/rfc7515#section-3.1}\n * */\n public async createJwsCompact(\n agentContext: AgentContext,\n { payload, keyId, protectedHeaderOptions }: CreateCompactJwsOptions\n ): Promise<string> {\n const { base64Payload, base64UrlProtectedHeader, signature } = await this.createJwsBase(agentContext, {\n payload,\n keyId,\n protectedHeaderOptions,\n })\n return `${base64UrlProtectedHeader}.${base64Payload}.${signature}`\n }\n\n /**\n * Verify a JWS\n */\n public async verifyJws(\n agentContext: AgentContext,\n {\n jws,\n resolveJwsSigner,\n trustedCertificates,\n jwsSigner: expectedJwsSigner,\n allowedJwsSignerMethods = ['did', 'jwk', 'x5c'],\n }: VerifyJwsOptions\n ): Promise<VerifyJwsResult> {\n let signatures: JwsDetachedFormat[] = []\n let payload: string\n\n if (expectedJwsSigner && !allowedJwsSignerMethods.includes(expectedJwsSigner.method)) {\n throw new CredoError(\n `jwsSigner provided with method '${\n expectedJwsSigner.method\n }', but allowed jws signer methods are ${allowedJwsSignerMethods.join(', ')}.`\n )\n }\n\n if (typeof jws === 'string') {\n if (!JWS_COMPACT_FORMAT_MATCHER.test(jws)) throw new CredoError(`Invalid JWS compact format for value '${jws}'.`)\n\n const [protectedHeader, _payload, signature] = jws.split('.')\n\n payload = _payload\n signatures.push({\n header: {},\n protected: protectedHeader,\n signature,\n })\n } else if ('signatures' in jws) {\n signatures = jws.signatures\n payload = jws.payload\n } else {\n signatures.push(jws)\n payload = jws.payload\n }\n\n if (signatures.length === 0) {\n throw new CredoError('Unable to verify JWS, no signatures present in JWS.')\n }\n\n const jwsFlattened = {\n signatures,\n payload,\n } satisfies JwsFlattenedFormat\n\n const jwsSigners: JwsSignerWithJwk[] = []\n for (const jws of signatures) {\n const protectedJson = JsonEncoder.fromBase64Url(jws.protected)\n\n if (!isJsonObject(protectedJson)) {\n throw new CredoError('Unable to verify JWS, protected header is not a valid JSON object.')\n }\n\n if (!protectedJson.alg || typeof protectedJson.alg !== 'string') {\n throw new CredoError('Unable to verify JWS, protected header alg is not provided or not a string.')\n }\n\n const jwsSigner =\n expectedJwsSigner ??\n (await this.jwsSignerFromJws(agentContext, {\n jws,\n payload,\n protectedHeader: {\n ...protectedJson,\n alg: protectedJson.alg,\n },\n allowedJwsSignerMethods,\n resolveJwsSigner,\n }))\n\n await this.verifyJwsSigner(agentContext, {\n jwsSigner,\n trustedCertificates,\n })\n\n if (!jwsSigner.jwk.supportedSignatureAlgorithms.includes(protectedJson.alg as KnownJwaSignatureAlgorithm)) {\n throw new CredoError(\n `alg '${protectedJson.alg}' is not a valid JWA signature algorithm for this jwk ${getJwkHumanDescription(jwsSigner.jwk.toJson())}. Supported algorithms are ${jwsSigner.jwk.supportedSignatureAlgorithms.join(', ')}`\n )\n }\n\n const data = TypedArrayEncoder.fromUtf8String(`${jws.protected}.${payload}`)\n const signature = TypedArrayEncoder.fromBase64Url(jws.signature)\n jwsSigners.push(jwsSigner)\n\n const kms = agentContext.dependencyManager.resolve(KeyManagementApi)\n\n try {\n const { verified } = await kms.verify({\n key: {\n publicJwk: jwsSigner.jwk.toJson(),\n },\n data,\n signature,\n algorithm: protectedJson.alg as KnownJwaSignatureAlgorithm,\n })\n\n if (!verified) {\n return {\n isValid: false,\n jwsSigners: [],\n jws: jwsFlattened,\n }\n }\n } catch (error) {\n // WalletError probably means signature verification failed. Would be useful to add\n // more specific error type in kms.verify method\n if (error instanceof KeyManagementError) {\n return {\n isValid: false,\n jwsSigners: [],\n jws: jwsFlattened,\n }\n }\n\n throw error\n }\n }\n\n return { isValid: true, jwsSigners, jws: jwsFlattened }\n }\n\n private buildProtected(options: JwsProtectedHeaderOptions) {\n return {\n ...options,\n alg: options.alg,\n jwk: options.jwk instanceof PublicJwk ? options.jwk.toJson() : options.jwk,\n kid: options.kid,\n }\n }\n\n private async verifyJwsSigner(\n agentContext: AgentContext,\n options: {\n jwsSigner: JwsSignerWithJwk\n trustedCertificates?: EncodedX509Certificate[] | X509VerificationTrustedCertificates[]\n }\n ) {\n const { jwsSigner } = options\n const x509ModuleConfig = agentContext.dependencyManager.resolve(X509ModuleConfig)\n\n if (jwsSigner.method === 'x5c') {\n const trustedCertificatesFromConfig = x509ModuleConfig.trustedCertificates ?? []\n const trustedCertificates = options.trustedCertificates ?? trustedCertificatesFromConfig\n if (trustedCertificates.length === 0) {\n throw new CredoError(\n `trustedCertificates is required when the JWS protected header contains an 'x5c' property.`\n )\n }\n\n const convertedTrustedCertificates = convertLegacyTrustedCertificates(trustedCertificates)\n\n await X509Service.validateCertificateChain(agentContext, {\n certificateChain: jwsSigner.x5c,\n trustedCertificates: convertedTrustedCertificates.flatMap(({ issuance }) => issuance),\n })\n }\n }\n\n private async jwsSignerFromJws(\n agentContext: AgentContext,\n options: {\n jws: JwsDetachedFormat\n allowedJwsSignerMethods: JwsSigner['method'][]\n protectedHeader: { alg: string; [key: string]: unknown }\n payload: string\n resolveJwsSigner?: JwsSignerResolver\n }\n ): Promise<JwsSignerWithJwk> {\n const { protectedHeader, resolveJwsSigner, jws, payload, allowedJwsSignerMethods } = options\n\n const alg = protectedHeader.alg\n if (!isKnownJwaSignatureAlgorithm(alg)) {\n throw new CredoError(`Unsupported JWA signature algorithm '${protectedHeader.alg}'`)\n }\n\n if (protectedHeader.x5c && allowedJwsSignerMethods.includes('x5c')) {\n if (\n !Array.isArray(protectedHeader.x5c) ||\n protectedHeader.x5c.some((certificate) => typeof certificate !== 'string')\n ) {\n throw new CredoError('x5c header is not a valid JSON array of strings.')\n }\n\n const certificate = X509Service.getLeafCertificate(agentContext, {\n certificateChain: protectedHeader.x5c,\n })\n return {\n method: 'x5c',\n jwk: certificate.publicJwk,\n x5c: protectedHeader.x5c,\n }\n }\n\n // Jwk\n if (protectedHeader.jwk && allowedJwsSignerMethods.includes('jwk')) {\n if (!isJsonObject(protectedHeader.jwk)) throw new CredoError('JWK is not a valid JSON object.')\n\n const protectedJwk = PublicJwk.fromUnknown(protectedHeader.jwk)\n\n return {\n method: 'jwk',\n jwk: protectedJwk,\n }\n }\n\n if (!resolveJwsSigner) {\n throw new CredoError(`resolveJwsSigner is required for resolving jws signers other than 'jwk' and 'x5c'.`)\n }\n\n try {\n const jwsSigner = await resolveJwsSigner({\n jws,\n protectedHeader: {\n ...protectedHeader,\n alg,\n },\n payload,\n })\n\n if (!allowedJwsSignerMethods.includes(jwsSigner.method)) {\n throw new CredoError(\n `resolveJwsSigner returned jws signer with method '${\n jwsSigner.method\n }', but allowed jws signer methods are ${allowedJwsSignerMethods.join(', ')}.`\n )\n }\n\n return jwsSigner\n } catch (error) {\n throw new CredoError(`Error when resolving jws signer for jws in resolveJwsSigner. ${error.message}`, {\n cause: error,\n })\n }\n }\n}\n\nexport interface CreateJwsOptions {\n payload: Uint8Array | JwtPayload\n keyId: string\n header: Record<string, unknown>\n protectedHeaderOptions: JwsProtectedHeaderOptions\n}\n\ntype CreateJwsBaseOptions = Omit<CreateJwsOptions, 'header'>\ntype CreateCompactJwsOptions = Omit<CreateJwsOptions, 'header'>\n\nexport interface VerifyJwsOptions {\n jws: Jws\n\n /**\n * The expected signer of the JWS. If provided the signer won't be dynamically\n * detected based on the values in the JWS.\n */\n jwsSigner?: JwsSignerWithJwk\n\n /**\n * Allowed jws signer methods when dynamically inferring the jws signer method.\n */\n allowedJwsSignerMethods?: JwsSigner['method'][]\n\n /*\n * Method that should return the JWS signer was used\n * to sign the JWS.\n *\n * This method is called by the JWS Service when it could not determine the public key.\n *\n * Currently the JWS Service can only determine the public key if the JWS protected header\n * contains a `jwk` or `x5c` property. In all other cases, it's up to the caller to resolve the public\n * key based on the JWS.\n *\n * A common use case is the `kid` property in the JWS protected header. Or determining the key\n * base on the `iss` property in the JWT payload.\n */\n resolveJwsSigner?: JwsSignerResolver\n\n trustedCertificates?: EncodedX509Certificate[] | X509VerificationTrustedCertificates[]\n}\n\nexport type JwsSignerResolver = (options: {\n jws: JwsDetachedFormat\n payload: string\n protectedHeader: {\n alg: KnownJwaSignatureAlgorithm\n jwk?: string\n kid?: string\n [key: string]: unknown\n }\n}) => Promise<JwsSignerWithJwk> | JwsSignerWithJwk\n\nexport interface VerifyJwsResult {\n isValid: boolean\n jwsSigners: JwsSignerWithJwk[]\n\n jws: JwsFlattenedFormat\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA+BO,IAAM,aAAN,MAAM,WAAW;CACtB,MAAc,cAAc,cAA4B,SAA+B;EACrF,MAAM,EAAE,KAAK,KAAK,QAAQ,QAAQ;EAElC,MAAM,MAAM,aAAa,kBAAkB,QAAQ,gBAAgB;EAEnE,MAAM,MAAM,MAAM,IAAI,aAAa,EAAE,OAAO,QAAQ,MAAM,CAAC;EAC3D,oBAAoB,GAAG;EAEvB,MAAM,YAAY,UAAU,cAAc,GAAG;EAG7C,IAAI,KAAK;GACP,MAAM,cAAc,YAAY,mBAAmB,cAAc,EAC/D,kBAAkB,IACpB,CAAC;GAED,IAAI,CAAC,2BAA2B,YAAY,UAAU,OAAO,GAAG,GAAG,GACjE,MAAM,IAAI,WAAW,sDAAsD;EAE/E;EAEA,MAAM,cAAc,eAAe,YAAY,MAAM,MAAM,UAAU,YAAY,GAAG,IAAI,KAAA;EAExF,IAAI,e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IAAI,WAAW,wCAAwC,gBAAgB,IAAI,EAAE;EAGrF,IAAI,gBAAgB,OAAO,wBAAwB,SAAS,KAAK,GAAG;GAClE,IACE,CAAC,MAAM,QAAQ,gBAAgB,GAAG,KAClC,gBAAgB,IAAI,MAAM,gBAAgB,OAAO,gBAAgB,QAAQ,GAEzE,MAAM,IAAI,WAAW,kDAAkD;GAMzE,OAAO;IACL,QAAQ;IACR,KALkB,YAAY,mBAAmB,cAAc,EAC/D,kBAAkB,gBAAgB,IACpC,CAGiB,CAAC,CAAC;IACjB,KAAK,gBAAgB;GACvB;EACF;EAGA,IAAI,gBAAgB,OAAO,wBAAwB,SAAS,KAAK,GAAG;GAClE,IAAI,CAAC,aAAa,gBAAgB,GAAG,GAAG,MAAM,IAAI,WAAW,iCAAiC;GAI9F,OAAO;IACL,QAAQ;IACR,KAJmB,UAAU,YAAY,gBAAgB,GAIzC;GAClB;EACF;EAEA,IAAI,CAAC,kBACH,MAAM,IAAI,WAAW,oFAAoF;EAG3G,IAAI;GACF,MAAM,YAAY,MAAM,iBAAiB;IACvC;IACA,iBAAiB;KACf,GAAG;KACH;IACF;IACA;GACF,CAAC;GAED,IAAI,CAAC,wBAAwB,SAAS,UAAU,MAAM,GACpD,MAAM,IAAI,WACR,qDACE,UAAU,OACX,wCAAwC,wBAAwB,KAAK,IAAI,EAAE,EAC9E;GAGF,OAAO;EACT,SAAS,OAAO;GACd,MAAM,IAAI,WAAW,gEAAgE,MAAM,WAAW,EACpG,OAAO,MACT,CAAC;EACH;CACF;AACF;AA7UC,aAAA,WAAA,CAAA,WAAW,CAAA,GAAA,UAAA"}
|
package/build/crypto/index.d.mts
CHANGED
|
@@ -11,7 +11,7 @@ import "./webcrypto/index.mjs";
|
|
|
11
11
|
import { JwtPayload, JwtPayloadJson, JwtPayloadOptions } from "./jose/jwt/JwtPayload.mjs";
|
|
12
12
|
import { Jwt } from "./jose/jwt/Jwt.mjs";
|
|
13
13
|
import { JwsSigner, JwsSignerDid, JwsSignerJwk, JwsSignerWithJwk, JwsSignerX5c } from "./JwsSigner.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { JwsDetachedFormat, JwsFlattenedDetachedFormat, JwsGeneralFormat, JwsProtectedHeaderOptions } from "./JwsTypes.mjs";
|
|
15
15
|
import { JwsService } from "./JwsService.mjs";
|
|
16
16
|
import "./jose/index.mjs";
|
|
17
|
-
export { CredoWebCrypto, CredoWebCryptoKey, HashName, Hasher, type
|
|
17
|
+
export { CredoWebCrypto, CredoWebCryptoKey, HashName, Hasher, type JwsDetachedFormat, type JwsFlattenedDetachedFormat, type JwsGeneralFormat, type JwsProtectedHeaderOptions, JwsService, type JwsSigner, type JwsSignerDid, type JwsSignerJwk, type JwsSignerWithJwk, type JwsSignerX5c, Jwt, JwtPayload, type JwtPayloadJson, type JwtPayloadOptions, type KeyGenAlgorithm, type KeySignParams, Sha1, Sha256, Sha384, Sha512, jwaAlgorithmToKeySignParams, keyParamsToJwaAlgorithm, publicJwkToCryptoKeyAlgorithm };
|
package/build/index.d.mts
CHANGED
|
@@ -182,7 +182,7 @@ import { Mdoc } from "./modules/mdoc/Mdoc.mjs";
|
|
|
182
182
|
import { GetTrustedIssuersForVerification, TrustedIssuer, TrustedIssuerDid, TrustedIssuerX509, TrustedIssuersForVerificationContext, TrustedIssuersForVerificationResult, VerificationSigner, VerificationSignerDid, VerificationSignerX509, VerificationTypeCredential, VerificationTypeMdocReaderAuth } from "./agent/TrustedIssuersForVerification.mjs";
|
|
183
183
|
import { X509ModuleConfig, X509ModuleConfigOptions, X509VerificationContext, X509VerificationTrustedCertificates, X509VerificationTypeCredential, X509VerificationTypeMdocReaderAuth, X509VerificationTypeOauth2ClientAttestation, X509VerificationTypeOauth2SecuredAuthorizationRequest, X509VerificationTypeOpenId4VciCredentialIssuerMetadata, X509VerificationTypeOpenId4VciKeyAttestation } from "./modules/x509/X509ModuleConfig.mjs";
|
|
184
184
|
import { JwsSigner, JwsSignerDid, JwsSignerJwk, JwsSignerWithJwk, JwsSignerX5c } from "./crypto/JwsSigner.mjs";
|
|
185
|
-
import {
|
|
185
|
+
import { JwsDetachedFormat, JwsFlattenedDetachedFormat, JwsGeneralFormat, JwsProtectedHeaderOptions } from "./crypto/JwsTypes.mjs";
|
|
186
186
|
import { JwsService } from "./crypto/JwsService.mjs";
|
|
187
187
|
import "./crypto/index.mjs";
|
|
188
188
|
import { index_d_exports } from "./modules/kms/index.mjs";
|
|
@@ -269,8 +269,8 @@ import { DcqlJwtVpPresentationToCreate, DcqlJwtW3cVpPresentationToCreate, DcqlLd
|
|
|
269
269
|
import "./modules/dcql/index.mjs";
|
|
270
270
|
import { didKeyToEd25519PublicJwk, didKeyToVerkey, isDidKey, verkeyToDidKey, verkeyToPublicJwk } from "./modules/dids/helpers.mjs";
|
|
271
271
|
import { didDocumentJsonToNumAlgo1Did } from "./modules/dids/methods/peer/peerDidNumAlgo1.mjs";
|
|
272
|
-
import { didDocumentToNumAlgo2Did
|
|
273
|
-
import { didDocumentToNumAlgo4Did
|
|
272
|
+
import { didDocumentToNumAlgo2Did } from "./modules/dids/methods/peer/peerDidNumAlgo2.mjs";
|
|
273
|
+
import { didDocumentToNumAlgo4Did } from "./modules/dids/methods/peer/peerDidNumAlgo4.mjs";
|
|
274
274
|
import { isStorageUpToDate } from "./storage/migration/isUpToDate.mjs";
|
|
275
275
|
import { StorageVersionRecord, StorageVersionRecordProps } from "./storage/migration/repository/StorageVersionRecord.mjs";
|
|
276
276
|
import { StorageVersionRepository } from "./storage/migration/repository/StorageVersionRepository.mjs";
|
|
@@ -311,5 +311,5 @@ declare const utils: {
|
|
|
311
311
|
addSecondsToDate: typeof addSecondsToDate;
|
|
312
312
|
};
|
|
313
313
|
//#endregion
|
|
314
|
-
export { ALL_REVOCATION_REASONS_MASK, ANONCREDS_DATA_INTEGRITY_CRYPTOSUITE, ANONCREDS_W3C_CREDENTIAL_CRYPTOSUITE, Agent, type AgentApi, AgentConfig, AgentContext, AgentContextProvider, type AgentDependencies, AnonCredsDataIntegrityServiceSymbol, AnonCredsW3cCredentialCreatePresentation, AnonCredsW3cCredentialProof, AnonCredsW3cCredentialProofOptions, AnonCredsW3cCredentialServiceSymbol, AnonCredsW3cCredentialVerifyPresentation, AnoncredsDataIntegrityCreatePresentation, AnoncredsDataIntegrityVerifyPresentation, ApiModule, BaseAgent, BaseEvent, BaseLogger, type BaseName, BaseRecord, BaseRecordAny, type BaseRecordConstructor, CREDENTIALS_CONTEXT_V1_URL, CREDENTIALS_CONTEXT_V2_URL, CREDENTIALS_ISSUER_URL, type Cache, CacheModule, CacheModuleConfig, type CacheModuleOptions, type CacheOptions, CachedStorageService, type CanBePromise, CertificateSigningRequest, CertificateSigningRequestOptions, ClaimFormat, type ClaimPath, ClassValidationError, ConsoleLogger, type Constructable, type Constructor, ContentType, CreateTokenStatusListOptions, CredentialIssuancePurpose, CredentialMultiInstanceState, CredentialMultiInstanceUseMode, type CredentialMultiInstanceUseUpdateMode, CredoError, CredoWebCrypto, CredoWebCryptoKey, CustomDidTags, CustomW3cCredentialTags, DID_V1_CONTEXT_URL, DataIntegrityProof, DataIntegrityProofOptions, DateOnly, DateTransformer, DcqlClaimSetDisclosedPaths, DcqlCredential, DcqlCredentialsForRequest, DcqlEncodedPresentations, DcqlEncodedPresentationsEntry, DcqlError, DcqlFailedCredential, DcqlJwtVpPresentationToCreate, DcqlJwtW3cVpPresentationToCreate, DcqlLdpVpPresentationToCreate, DcqlMatchWithRecord, DcqlMdocCredential, DcqlMdocPresentationToCreate, DcqlModule, DcqlPresentation, DcqlPresentationResult, DcqlPresentationsToCreate, DcqlQuery, DcqlQueryResult, DcqlSdJwtVcCredential, DcqlSdJwtVcPresentationToCreate, DcqlSdJwtW3cVpPresentationToCreate, DcqlSelectCredentialsForRequestOptions, DcqlSelectiveDisclosure, DcqlService, DcqlValidCredential, DcqlW3cVcCredential, DefaultAgentContextProvider, type DefaultAgentModules, DefaultMdocRecordTags, DefaultMdocVerificationSessionRecordTags, DefaultSdJwtVcRecordTags, DefaultW3cCredentialTags, DefaultW3cV2CredentialTags, DependencyManager, DeviceAndIssuerClaims, DidCommV1Service, LegacyDidCommV2Service as DidCommV2Service, type LegacyDidCommV2ServiceOptions as DidCommV2ServiceOptions, DidCreateOptions, DidCreateResult, DidDeactivateOptions, DidDeactivateResult, DidDocument, DidDocumentBuilder, DidDocumentKey, DidDocumentMetadata, DidDocumentOperation, DidDocumentRole, DidDocumentService, DidJwk, DidKey, DidOperationStateActionBase, DidOperationStateFailed, DidOperationStateFinished, DidOperationStateWait, DidPurpose, DidRecord, DidRecordMetadataKeys, DidRecordProps, DidRegistrar, DidRegistrarService, DidRegistrationExtraOptions, DidRegistrationMetadata, DidRegistrationSecretOptions, DidRepository, DidResolutionMetadata, DidResolutionOptions, DidResolutionResult, DidResolver, DidResolverService, DidUpdateOptions, DidUpdateResult, DidsApi, DidsModule, DidsModuleConfig, DidsModuleConfigOptions, DifPexCredentialsForRequest, DifPexCredentialsForRequestRequirement, DifPexCredentialsForRequestSubmissionEntry, DifPexInputDescriptorToCredentials, type DifPexPresentationWithDescriptor, DifPresentationExchangeDefinition, DifPresentationExchangeDefinitionV1, DifPresentationExchangeDefinitionV2, DifPresentationExchangeError, DifPresentationExchangeModule, DifPresentationExchangeService, DifPresentationExchangeSubmission, PresentationSubmissionLocation as DifPresentationExchangeSubmissionLocation, type DocumentLoader, type DownloadToFileOptions, ENVELOPED_VERIFIABLE_CREDENTIAL_TYPE, ENVELOPED_VERIFIABLE_PRESENTATION_TYPE, EXPANDED_TYPE_CREDENTIALS_CONTEXT_V1_VC_TYPE, Ed25519Signature2018, Ed25519Signature2020, type EmptyModuleMap, EncodedX509Certificate, EventEmitter, EventMetadata, FetchTokenStatusListOptions, type FileSystem, GenericRecord, GenericRecordStorageProps, GenericRecordTags, GenericRecordsApi, GenericRecordsModule, GetTrustedIssuersForVerification, HashName, Hasher, IAnonCredsDataIntegrityService, IAnonCredsW3cCredentialService, IDisclosureFrame, IPresentationFrame, ImportDidOptions, InMemoryLruCache, type InMemoryLruCacheOptions, IndyAgentService, type InitConfig, InjectionSymbols, type InjectionToken, IntegrityVerifier, IsEnvelopedVerifiableCredentialType, IsEnvelopedVerifiablePresentationType, IsStringOrInstance, IsStringOrInstanceOrArrayOfInstances, IsStringOrStringArray, IsStringOrVerificationMethod, IsUri, IsW3cCredentialSubject, IsW3cIssuer, IsW3cV2Issuer, type JsonArray, JsonEncoder, JsonLdModule, JsonLdModuleConfig, JsonLdModuleConfigOptions, type JsonObject, JsonTransformer, type JsonValue, JwkDidCreateOptions, JwkDidDeactivateOptions, JwkDidRegistrar, JwkDidResolver, JwkDidUpdateOptions, type Jws, type JwsCompactFormat, type JwsDetachedFormat, type JwsFlattenedDetachedFormat, type JwsFlattenedFormat, type JwsGeneralFormat, JwsLinkedDataSignature, JwsLinkedDataSignatureOptions, type JwsProtectedHeaderOptions, JwsService, type JwsSigner, type JwsSignerDid, type JwsSignerJwk, type JwsSignerWithJwk, type JwsSignerX5c, Jwt, JwtPayload, type JwtPayloadJson, type JwtPayloadOptions, KeyDidCreateOptions, KeyDidDeactivateOptions, KeyDidRegistrar, KeyDidResolver, KeyDidUpdateOptions, type KeyGenAlgorithm, type KeySignParams, index_d_exports as Kms, LdKeyPair, LdKeyPairOptions, LinkedDataProof, LinkedDataProofOptions, LogLevel, Logger, Mdoc, MdocApi, MdocClaimMatch, MdocDcApiCreateResponseOptions, MdocDcApiCreateVerificationSessionOptions, MdocDcApiCredentialMatch, MdocDcApiDocRequest, MdocDcApiFailedCredential, MdocDcApiRequest, MdocDcApiResolveRequestOptions, MdocDcApiResolvedDocRequest, MdocDcApiResolvedDocRequestFailure, MdocDcApiResolvedDocRequestSuccess, MdocDcApiResolvedRequest, MdocDcApiResponse, MdocDcApiService, MdocDcApiValidCredential, MdocDcApiVerifyResponseOptions, MdocDeleteVerificationSessionOptions, MdocDeviceRequestDefinition, MdocDeviceRequestMatch, MdocDeviceRequestNotSatisfiedError, MdocDeviceResponse, MdocDeviceResponseDcqlQueryOptions, MdocDeviceResponseOptions, MdocDeviceResponsePresentationDefinitionOptions, MdocDeviceResponseVerifyOptions, MdocDocRequestDefinition, MdocDocumentRequest, MdocElementSource, MdocError, MdocEventTypes, MdocIsoDcApiVerificationSessionTranscript, MdocModule, MdocNameSpaces, MdocOpenId4VpDcApiDraft24SessionTranscriptOptions, MdocOpenId4VpDcApiSessionTranscriptOptions, MdocOpenId4VpDraft18SessionTranscriptOptions, MdocOpenId4VpSessionTranscriptOptions, MdocRecord, MdocRecordInstances, MdocRecordStorageProps, MdocRepository, MdocRequestedElement, MdocService, MdocSessionTranscriptByteOptions, MdocSessionTranscriptOptions, MdocSignOptions, MdocStoreOptions, type MdocSupportedSignatureAlgorithm, MdocVerificationSessionExpiredError, MdocVerificationSessionRecord, MdocVerificationSessionRecordProps, MdocVerificationSessionRepository, MdocVerificationSessionState, MdocVerificationSessionStateChangedEvent, MdocVerificationSessionTranscript, MdocVerifyOptions, MessageValidator, Metadata, type MetadataBase, Module, type ModulesMap, MultiBaseEncoder, MultiHashEncoder, NON_DISCLOSEABLE_FIELDS, DidCommV2Service as NewDidCommV2Service, DidCommV2ServiceEndpoint as NewDidCommV2ServiceEndpoint, type DidCommV2ServiceEndpointOptions as NewDidCommV2ServiceEndpointOptions, type NonEmptyArray, type Optional, ParsedDid, PeerDidCreateOptions, PeerDidDeactivateOptions, PeerDidNumAlgo, PeerDidNumAlgo0CreateOptions, PeerDidNumAlgo1CreateOptions, PeerDidNumAlgo2CreateOptions, PeerDidNumAlgo4CreateOptions, PeerDidRegistrar, PeerDidResolver, PeerDidUpdateOptions, type Proof, ProofPurpose, Purposes, type Query, type QueryOptions, RecordDeletedEvent, RecordDuplicateError, RecordNotFoundError, RecordSavedEvent, RecordTags, RecordUpdatedEvent, Repository, RepositoryEventTypes, type ResolvedDidCommService, SECURITY_CONTEXT_SECP256k1_URL, SECURITY_CONTEXT_URL, SECURITY_CONTEXT_V1_URL, SECURITY_CONTEXT_V2_URL, SECURITY_CONTEXT_V3_URL, SECURITY_ED25519_2018_CONTEXT_URL, SECURITY_ED25519_2020_CONTEXT_URL, SECURITY_JWS_CONTEXT_URL, SECURITY_PROOF_URL, SECURITY_SIGNATURE_URL, SECURITY_X25519_CONTEXT_URL, SaveGenericRecordOption, SdJwtVc, SdJwtVcApi, SdJwtVcError, SdJwtVcHeader, SdJwtVcHolderBinding, SdJwtVcHolderDidBinding, SdJwtVcHolderJwkBinding, SdJwtVcIssuer, SdJwtVcIssuerDid, SdJwtVcIssuerX5c, SdJwtVcModule, type SdJwtVcPayload, SdJwtVcPresentOptions, SdJwtVcRecord, SdJwtVcRecordInstances, SdJwtVcRecordStorageProps, SdJwtVcRepository, SdJwtVcService, SdJwtVcSignOptions, SdJwtVcStoreOptions, SdJwtVcTypeMetadata, SdJwtVcTypeMetadataClaim, SdJwtVcTypeMetadataDisplay, SdJwtVcTypeMetadataRenderingMethodSimple, SdJwtVcTypeMetadataRenderingMethodSvgTemplate, SdJwtVcVerifyOptions, ServiceTransformer, Sha1, Sha256, Sha384, Sha512, SignatureSuiteRegistry, SignatureSuiteToken, type SimpleQuery, type SingleContextLruCacheItem, SingleContextLruCacheRecord, SingleContextStorageLruCache, type SingleContextStorageLruCacheOptions, type SingleOrArray, SingleValidationResult, StatusListCwt, type StatusListCwtOptions, StatusListInput, type StorageService, StorageUpdateService, StorageVersionRecord, StorageVersionRecordProps, StorageVersionRepository, SubmissionEntryCredential, SuiteInfo, Suites, TagValue, Tags, TagsBase, TokenStatusListApi, TokenStatusListFormat, TokenStatusListModule, TokenStatusListResult, TokenStatusListResultFor, TokenStatusListService, TrustedIssuer, TrustedIssuerContext, TrustedIssuerDid, TrustedIssuerX509, TrustedIssuersForVerificationContext, TrustedIssuersForVerificationResult, TypedArrayEncoder, type UnionToIntersection, type Update, UpdateAssistant, UpdateAssistantUpdateOptions, type UpdateConfig, UpdateTokenStatusListOptions, type UseInstanceFromCredentialRecordOptions, type UseInstanceFromCredentialRecordReturn, type V0_1ToV0_2UpdateConfig, VERIFIABLE_CREDENTIAL_TYPE, VERIFIABLE_PRESENTATION_TYPE, VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019, VERIFICATION_METHOD_TYPE_ED25519_VERIFICATION_KEY_2018, VERIFICATION_METHOD_TYPE_ED25519_VERIFICATION_KEY_2020, VERIFICATION_METHOD_TYPE_JSON_WEB_KEY_2020, VERIFICATION_METHOD_TYPE_MULTIKEY, VERIFICATION_METHOD_TYPE_X25519_KEY_AGREEMENT_KEY_2019, VerifiableCredential, VerifiablePresentation, VerificationMethod, VerificationMethodTransformer, VerificationResult, VerificationSigner, VerificationSignerDid, VerificationSignerX509, VerificationTypeCredential, VerificationTypeMdocReaderAuth, type VersionString, W3cCreatePresentationOptions, W3cCredential, W3cCredentialOptions, W3cCredentialRecord, W3cCredentialRecordInstances, W3cCredentialRecordOptions, W3cCredentialRepository, W3cCredentialSchema, W3cCredentialSchemaOptions, W3cCredentialService, W3cCredentialStatus, W3cCredentialStatusOptions, W3cCredentialSubject, W3cCredentialSubjectOptions, W3cCredentialSubjectTransformer, W3cCredentialsApi, W3cCredentialsModule, W3cCredentialsModuleConfig, W3cCredentialsModuleConfigOptions, W3cDataIntegrityApi, type W3cDataIntegrityCreateFailure, type W3cDataIntegrityCreateProofOptions, type W3cDataIntegrityCreateResult, type W3cDataIntegrityCreateSuccess, type W3cDataIntegrityCryptosuite, type W3cDataIntegrityCryptosuiteInfo, type W3cDataIntegrityCryptosuiteProof, type W3cDataIntegrityCryptosuiteProofOptions, type W3cDataIntegrityIssueList, W3cDataIntegrityModule, W3cDataIntegrityProcessingErrorCode, type W3cDataIntegrityProcessingIssue, type W3cDataIntegrityProofSet, type W3cDataIntegrityProofSetSecuredDocument, type W3cDataIntegritySecuredDocument, type W3cDataIntegritySingleProofSecuredDocument, type W3cDataIntegrityUnsecuredDocument, type W3cDataIntegrityVerifyFailure, type W3cDataIntegrityVerifyProofDocumentOptions, type W3cDataIntegrityVerifyProofOptions, type W3cDataIntegrityVerifyResult, type W3cDataIntegrityVerifySuccess, W3cIssuer, W3cIssuerOptions, W3cIssuerTransformer, W3cJsonCredential, W3cJsonLdCredentialService, W3cJsonLdDeriveProofOptions, W3cJsonLdSignCredentialOptions, W3cJsonLdSignPresentationOptions, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiableCredentialOptions, W3cJsonLdVerifiablePresentation, W3cJsonLdVerifiablePresentationOptions, W3cJsonLdVerifyCredentialOptions, W3cJsonLdVerifyPresentationOptions, W3cJsonPresentation, W3cJwtCredentialService, W3cJwtSignCredentialOptions, W3cJwtSignPresentationOptions, W3cJwtVerifiableCredential, W3cJwtVerifiableCredentialOptions, W3cJwtVerifiablePresentation, W3cJwtVerifiablePresentationOptions, W3cJwtVerifyCredentialOptions, W3cJwtVerifyPresentationOptions, W3cPresentation, W3cPresentationOptions, W3cSignCredentialOptions, W3cSignPresentationOptions, W3cStoreCredentialOptions, W3cV2Credential, W3cV2CredentialOptions, W3cV2CredentialRecord, W3cV2CredentialRecordInstances, W3cV2CredentialRecordOptions, W3cV2CredentialRepository, W3cV2CredentialSchema, W3cV2CredentialSchemaOptions, W3cV2CredentialService, W3cV2CredentialStatus, W3cV2CredentialStatusOptions, W3cV2CredentialSubject, W3cV2CredentialSubjectOptions, W3cV2CredentialsApi, W3cV2CredentialsModule, W3cV2CredentialsModuleConfig, W3cV2CredentialsModuleConfigOptions, W3cV2DataIntegrityContextValidationResult, W3cV2DataIntegrityContextValidator, W3cV2DataIntegrityCredentialService, W3cV2DataIntegrityIssue, W3cV2DataIntegrityPresentationCredentialEntry, W3cV2DataIntegrityResolvedPresentation, W3cV2DataIntegritySecuredCredential, W3cV2DataIntegritySecuredPresentation, W3cV2DataIntegrityVerifiableCredential, W3cV2DataIntegrityVerifiableCredentialOptions, W3cV2DataIntegrityVerifiablePresentation, W3cV2DataIntegrityVerifiablePresentationOptions, W3cV2DiSignCredentialOptions, W3cV2DiSignPresentationOptions, W3cV2DiVerifyCredentialOptions, W3cV2DiVerifyPresentationOptions, W3cV2EnvelopedVerifiableCredential, W3cV2EnvelopedVerifiableCredentialOptions, W3cV2EnvelopedVerifiableCredentialTransformer, W3cV2EnvelopedVerifiablePresentation, W3cV2EnvelopedVerifiablePresentationOptions, W3cV2Evidence, W3cV2EvidenceOptions, W3cV2Issuer, W3cV2IssuerOptions, W3cV2IssuerTransformer, W3cV2JsonCredential, W3cV2JsonDataIntegrityPresentationEntry, W3cV2JsonEnvelopedVerifiableCredentialEntry, W3cV2JsonEnvelopedVerifiablePresentationEntry, W3cV2JsonLocalizedValue, W3cV2JsonPresentation, W3cV2JsonPresentationCredentialEntry, W3cV2JwtCredentialService, W3cV2JwtSignCredentialOptions, W3cV2JwtSignPresentationOptions, W3cV2JwtVerifiableCredential, W3cV2JwtVerifiableCredentialOptions, W3cV2JwtVerifiablePresentation, W3cV2JwtVerifiablePresentationOptions, W3cV2JwtVerifyCredentialOptions, W3cV2JwtVerifyPresentationOptions, W3cV2LocalizedValue, W3cV2LocalizedValueOptions, W3cV2LocalizedValueTransformer, W3cV2Presentation, W3cV2PresentationCredentialEntry, W3cV2PresentationCredentialEntryOptions, W3cV2PresentationCredentialEntryResult, W3cV2PresentationCredentialEntryTransformer, W3cV2PresentationOptions, W3cV2RefreshService, W3cV2RefreshServiceOptions, W3cV2SdJwt, W3cV2SdJwtCredentialService, W3cV2SdJwtHeader, W3cV2SdJwtPayload, W3cV2SdJwtSignCredentialOptions, W3cV2SdJwtSignPresentationOptions, W3cV2SdJwtVcPresentOptions, W3cV2SdJwtVerifiableCredential, W3cV2SdJwtVerifiableCredentialOptions, W3cV2SdJwtVerifiablePresentation, W3cV2SdJwtVerifiablePresentationOptions, W3cV2SdJwtVerifyCredentialOptions, W3cV2SdJwtVerifyPresentationOptions, W3cV2SignCredentialOptions, W3cV2SignPresentationOptions, W3cV2StoreCredentialOptions, W3cV2TermsOfUse, W3cV2TermsOfUseOptions, W3cV2VerifiableCredential, W3cV2VerifiableCredentialOptions, W3cV2VerifiableCredentialTransformer, W3cV2VerifiablePresentation, W3cV2VerifiablePresentationOptions, W3cV2VerifiablePresentationTransformer, W3cV2VerifyCredentialOptions, W3cV2VerifyCredentialResult, W3cV2VerifyPresentationOptions, W3cV2VerifyPresentationResult, W3cVerifiableCredential, W3cVerifiableCredentialTransformer, W3cVerifiablePresentation, W3cVerifyCredentialOptions, W3cVerifyCredentialResult, W3cVerifyPresentationOptions, W3cVerifyPresentationResult, WebDidResolver, X509Api, X509Certificate, X509CertificateExtensionsOptions, X509CertificateIssuerAndSubjectOptions, X509CertificateOptions, X509CertificateRevocationList, X509CertificateRevocationListEntry, X509CertificateRevocationListEntryOptions, X509CertificateRevocationListEntryReason, X509CertificateRevocationListExtensionsOptions, X509CertificateSigningRequestExtensionsOptions, X509CertificateSingleValidationResult, X509CertificateValidations, X509CheckCertificateRevocationOptions, X509CreateCertificateChainOptions, X509CreateCertificateOptions, X509CreateCertificateRevocationListOptions, X509CreateCertificateSigningRequestOptions, X509CrlDistributionPoint, X509CrlExtensionIdentifier, X509CrlUnavailableError, X509Error, X509ExtendedKeyUsage, X509ExtensionIdentifier, X509FetchCertificateRevocationListOptions, X509GetLeafCertificateOptions, X509IssuingDistributionPoint, X509KeyUsage, X509Module, X509ModuleConfig, X509ModuleConfigOptions, X509ParseCertificateOptions, X509ParseCertificateRevocationListOptions, X509ParseCertificateSigningRequestOptions, X509RevocationCheckMode, X509RevocationCheckOptions, X509RevocationCheckResult, X509RevocationReason, X509RevocationService, X509Service, X509ValidateCertificateChainOptions, X509ValidationError, X509ValidationResult, X509VerificationContext, X509VerificationTrustedCertificates, X509VerificationTypeCredential, X509VerificationTypeMdocReaderAuth, X509VerificationTypeOauth2ClientAttestation, X509VerificationTypeOauth2SecuredAuthorizationRequest, X509VerificationTypeOpenId4VciCredentialIssuerMetadata, X509VerificationTypeOpenId4VciKeyAttestation, type XOR, ZodValidationError, asArray, canUseInstanceFromCredentialRecord, constants, convertLegacyTrustedCertificates, convertName, convertPublicKeyToX25519, createAuthorityKeyIdentifierExtension, createBasicConstraintsExtension, createCrlDistributionPointsExtension, createCrlEntryCertificateIssuerExtension, createCrlNumberExtension, createDeltaCrlIndicatorExtension, createExtendedKeyUsagesExtension, createIssuerAlternativeNameExtension, createIssuingDistributionPointExtension, createKeyUsagesExtension, createPeerDidDocumentFromServices, createSubjectAlternativeNameExtension, createSubjectKeyIdentifierExtension, dcqlGetPresentationsToCreate, decodeCursor, decodeSdJwt, decodeW3cV2VerifiableCredential, decodeW3cV2VerifiablePresentation, deepEquality, defaultDocumentLoader, deriveProof, didDocumentJsonToNumAlgo1Did, didDocumentToNumAlgo2Did, didDocumentToNumAlgo4Did, didKeyToEd25519PublicJwk, didKeyToVerkey, didToNumAlgo2DidDocument, didToNumAlgo4DidDocument, encodeCursor, equalsIgnoreOrder, equalsWithOrder, extractPresentationsWithDescriptorsFromSubmission, extractX509CertificatesFromJwt, filterContextCorrelationId, findMatchingEd25519Key, getAlternativeDidsForNumAlgo4Did, getAlternativeDidsForPeerDid, getApiForModuleByName, getDidPeer4ShortFormForEquivalence, getDirFromFilePath, getDomainFromUrl, getEcdsaSecp256k1VerificationKey2019, getEd25519VerificationKey2018, getEd25519VerificationKey2020, getJsonWebKey2020, getKmsKeyIdForVerifiacationMethod, getMultikey, getNumAlgoFromPeerDid, getPublicJwkFromEcdsaSecp256k1VerificationKey2019, getPublicJwkFromEd25519VerificationKey2018, getPublicJwkFromEd25519VerificationKey2020, getPublicJwkFromJsonWebKey2020, getPublicJwkFromMultikey, getPublicJwkFromVerificationMethod, getPublicJwkFrommX25519KeyAgreementKey2019, getRegisteredModuleByInstance, getRegisteredModuleByName, getX25519KeyAgreementKey2019, inject, injectAll, injectable, isDid, isDidKey, isEcdsaSecp256k1VerificationKey2019, isEd25519VerificationKey2018, isEd25519VerificationKey2020, isEmbeddedDataIntegrityPresentationEntry, isEnvelopedVerifiableCredentialEntry, isEnvelopedVerifiablePresentationEntry, isJsonObject, isJsonWebKey2020, isMdocSupportedSignatureAlgorithm, isMultikey, isNonEmptyArray, isShortFormDidPeer4, isStorageUpToDate, isValidPeerDid, isX25519KeyAgreementKey2019, joinUriParts, jwaAlgorithmToKeySignParams, keyDidEd25519, keyDidX25519, keyParamsToJwaAlgorithm, legacyTrustedCertificatesToTrustedIssuers, mapDataIntegrityIssuesToCredoError, mapNonEmptyArray, parseDid, presentationFromDataUri, presentationToDataUri, publicJwkToCryptoKeyAlgorithm, purposes, recordToCursor, replaceError, sdJwtVcHasher, serviceTypes, suites, tryParseDid, useInstanceFromCredentialRecord, utils, validateW3cV2SdJwtDisclosureFrame, vcLibraries, verkeyToDidKey, verkeyToPublicJwk, w3cDate, x509SignatureAlgorithmToJwa };
|
|
314
|
+
export { ALL_REVOCATION_REASONS_MASK, ANONCREDS_DATA_INTEGRITY_CRYPTOSUITE, ANONCREDS_W3C_CREDENTIAL_CRYPTOSUITE, Agent, type AgentApi, AgentConfig, AgentContext, AgentContextProvider, type AgentDependencies, AnonCredsDataIntegrityServiceSymbol, type AnonCredsW3cCredentialCreatePresentation, AnonCredsW3cCredentialProof, type AnonCredsW3cCredentialProofOptions, AnonCredsW3cCredentialServiceSymbol, type AnonCredsW3cCredentialVerifyPresentation, AnoncredsDataIntegrityCreatePresentation, AnoncredsDataIntegrityVerifyPresentation, ApiModule, BaseAgent, BaseEvent, BaseLogger, type BaseName, BaseRecord, BaseRecordAny, type BaseRecordConstructor, CREDENTIALS_CONTEXT_V1_URL, CREDENTIALS_CONTEXT_V2_URL, CREDENTIALS_ISSUER_URL, type Cache, CacheModule, CacheModuleConfig, type CacheModuleOptions, type CacheOptions, CachedStorageService, type CanBePromise, CertificateSigningRequest, CertificateSigningRequestOptions, ClaimFormat, type ClaimPath, ClassValidationError, ConsoleLogger, type Constructable, type Constructor, ContentType, CreateTokenStatusListOptions, CredentialIssuancePurpose, CredentialMultiInstanceState, CredentialMultiInstanceUseMode, type CredentialMultiInstanceUseUpdateMode, CredoError, CredoWebCrypto, CredoWebCryptoKey, CustomDidTags, CustomW3cCredentialTags, DID_V1_CONTEXT_URL, DataIntegrityProof, DataIntegrityProofOptions, DateOnly, DateTransformer, DcqlClaimSetDisclosedPaths, DcqlCredential, DcqlCredentialsForRequest, DcqlEncodedPresentations, DcqlEncodedPresentationsEntry, DcqlError, DcqlFailedCredential, DcqlJwtVpPresentationToCreate, DcqlJwtW3cVpPresentationToCreate, DcqlLdpVpPresentationToCreate, DcqlMatchWithRecord, DcqlMdocCredential, DcqlMdocPresentationToCreate, DcqlModule, DcqlPresentation, DcqlPresentationResult, DcqlPresentationsToCreate, DcqlQuery, DcqlQueryResult, DcqlSdJwtVcCredential, DcqlSdJwtVcPresentationToCreate, DcqlSdJwtW3cVpPresentationToCreate, DcqlSelectCredentialsForRequestOptions, DcqlSelectiveDisclosure, DcqlService, DcqlValidCredential, DcqlW3cVcCredential, DefaultAgentContextProvider, type DefaultAgentModules, DefaultMdocRecordTags, DefaultMdocVerificationSessionRecordTags, DefaultSdJwtVcRecordTags, DefaultW3cCredentialTags, DefaultW3cV2CredentialTags, DependencyManager, DeviceAndIssuerClaims, DidCommV1Service, LegacyDidCommV2Service as DidCommV2Service, type LegacyDidCommV2ServiceOptions as DidCommV2ServiceOptions, DidCreateOptions, DidCreateResult, DidDeactivateOptions, DidDeactivateResult, DidDocument, DidDocumentBuilder, DidDocumentKey, DidDocumentMetadata, DidDocumentOperation, DidDocumentRole, DidDocumentService, DidJwk, DidKey, DidOperationStateActionBase, DidOperationStateFailed, DidOperationStateFinished, DidOperationStateWait, DidPurpose, DidRecord, DidRecordMetadataKeys, DidRecordProps, DidRegistrar, DidRegistrarService, DidRegistrationExtraOptions, DidRegistrationMetadata, DidRegistrationSecretOptions, DidRepository, DidResolutionMetadata, DidResolutionOptions, DidResolutionResult, DidResolver, DidResolverService, DidUpdateOptions, DidUpdateResult, DidsApi, DidsModule, DidsModuleConfig, DidsModuleConfigOptions, DifPexCredentialsForRequest, DifPexCredentialsForRequestRequirement, DifPexCredentialsForRequestSubmissionEntry, DifPexInputDescriptorToCredentials, type DifPexPresentationWithDescriptor, DifPresentationExchangeDefinition, DifPresentationExchangeDefinitionV1, DifPresentationExchangeDefinitionV2, DifPresentationExchangeError, DifPresentationExchangeModule, DifPresentationExchangeService, DifPresentationExchangeSubmission, PresentationSubmissionLocation as DifPresentationExchangeSubmissionLocation, type DocumentLoader, type DownloadToFileOptions, ENVELOPED_VERIFIABLE_CREDENTIAL_TYPE, ENVELOPED_VERIFIABLE_PRESENTATION_TYPE, EXPANDED_TYPE_CREDENTIALS_CONTEXT_V1_VC_TYPE, Ed25519Signature2018, Ed25519Signature2020, type EmptyModuleMap, EncodedX509Certificate, EventEmitter, EventMetadata, FetchTokenStatusListOptions, type FileSystem, GenericRecord, GenericRecordStorageProps, GenericRecordTags, GenericRecordsApi, GenericRecordsModule, GetTrustedIssuersForVerification, HashName, Hasher, IAnonCredsDataIntegrityService, type IAnonCredsW3cCredentialService, IDisclosureFrame, IPresentationFrame, ImportDidOptions, InMemoryLruCache, type InMemoryLruCacheOptions, IndyAgentService, type InitConfig, InjectionSymbols, type InjectionToken, IntegrityVerifier, IsEnvelopedVerifiableCredentialType, IsEnvelopedVerifiablePresentationType, IsStringOrInstance, IsStringOrInstanceOrArrayOfInstances, IsStringOrStringArray, IsStringOrVerificationMethod, IsUri, IsW3cCredentialSubject, IsW3cIssuer, IsW3cV2Issuer, type JsonArray, JsonEncoder, JsonLdModule, JsonLdModuleConfig, JsonLdModuleConfigOptions, type JsonObject, JsonTransformer, type JsonValue, JwkDidCreateOptions, JwkDidDeactivateOptions, JwkDidRegistrar, JwkDidResolver, JwkDidUpdateOptions, type JwsDetachedFormat, type JwsFlattenedDetachedFormat, type JwsGeneralFormat, JwsLinkedDataSignature, JwsLinkedDataSignatureOptions, type JwsProtectedHeaderOptions, JwsService, type JwsSigner, type JwsSignerDid, type JwsSignerJwk, type JwsSignerWithJwk, type JwsSignerX5c, Jwt, JwtPayload, type JwtPayloadJson, type JwtPayloadOptions, KeyDidCreateOptions, KeyDidDeactivateOptions, KeyDidRegistrar, KeyDidResolver, KeyDidUpdateOptions, type KeyGenAlgorithm, type KeySignParams, index_d_exports as Kms, LdKeyPair, LdKeyPairOptions, LinkedDataProof, LinkedDataProofOptions, LogLevel, Logger, Mdoc, MdocApi, MdocClaimMatch, MdocDcApiCreateResponseOptions, MdocDcApiCreateVerificationSessionOptions, MdocDcApiCredentialMatch, MdocDcApiDocRequest, MdocDcApiFailedCredential, MdocDcApiRequest, MdocDcApiResolveRequestOptions, MdocDcApiResolvedDocRequest, MdocDcApiResolvedDocRequestFailure, MdocDcApiResolvedDocRequestSuccess, MdocDcApiResolvedRequest, MdocDcApiResponse, MdocDcApiService, MdocDcApiValidCredential, MdocDcApiVerifyResponseOptions, MdocDeleteVerificationSessionOptions, MdocDeviceRequestDefinition, MdocDeviceRequestMatch, MdocDeviceRequestNotSatisfiedError, MdocDeviceResponse, MdocDeviceResponseDcqlQueryOptions, MdocDeviceResponseOptions, MdocDeviceResponsePresentationDefinitionOptions, MdocDeviceResponseVerifyOptions, MdocDocRequestDefinition, MdocDocumentRequest, MdocElementSource, MdocError, MdocEventTypes, MdocIsoDcApiVerificationSessionTranscript, MdocModule, MdocNameSpaces, MdocOpenId4VpDcApiDraft24SessionTranscriptOptions, MdocOpenId4VpDcApiSessionTranscriptOptions, MdocOpenId4VpDraft18SessionTranscriptOptions, MdocOpenId4VpSessionTranscriptOptions, MdocRecord, MdocRecordInstances, MdocRecordStorageProps, MdocRepository, MdocRequestedElement, MdocService, MdocSessionTranscriptByteOptions, MdocSessionTranscriptOptions, MdocSignOptions, MdocStoreOptions, type MdocSupportedSignatureAlgorithm, MdocVerificationSessionExpiredError, MdocVerificationSessionRecord, MdocVerificationSessionRecordProps, MdocVerificationSessionRepository, MdocVerificationSessionState, MdocVerificationSessionStateChangedEvent, MdocVerificationSessionTranscript, MdocVerifyOptions, MessageValidator, Metadata, type MetadataBase, Module, type ModulesMap, MultiBaseEncoder, MultiHashEncoder, NON_DISCLOSEABLE_FIELDS, DidCommV2Service as NewDidCommV2Service, DidCommV2ServiceEndpoint as NewDidCommV2ServiceEndpoint, type DidCommV2ServiceEndpointOptions as NewDidCommV2ServiceEndpointOptions, type NonEmptyArray, type Optional, ParsedDid, PeerDidCreateOptions, PeerDidDeactivateOptions, PeerDidNumAlgo, PeerDidNumAlgo0CreateOptions, PeerDidNumAlgo1CreateOptions, PeerDidNumAlgo2CreateOptions, PeerDidNumAlgo4CreateOptions, PeerDidRegistrar, PeerDidResolver, PeerDidUpdateOptions, type Proof, ProofPurpose, Purposes, type Query, type QueryOptions, RecordDeletedEvent, RecordDuplicateError, RecordNotFoundError, RecordSavedEvent, RecordTags, RecordUpdatedEvent, Repository, RepositoryEventTypes, type ResolvedDidCommService, SECURITY_CONTEXT_SECP256k1_URL, SECURITY_CONTEXT_URL, SECURITY_CONTEXT_V1_URL, SECURITY_CONTEXT_V2_URL, SECURITY_CONTEXT_V3_URL, SECURITY_ED25519_2018_CONTEXT_URL, SECURITY_ED25519_2020_CONTEXT_URL, SECURITY_JWS_CONTEXT_URL, SECURITY_PROOF_URL, SECURITY_SIGNATURE_URL, SECURITY_X25519_CONTEXT_URL, SaveGenericRecordOption, SdJwtVc, SdJwtVcApi, SdJwtVcError, SdJwtVcHeader, SdJwtVcHolderBinding, SdJwtVcHolderDidBinding, SdJwtVcHolderJwkBinding, SdJwtVcIssuer, SdJwtVcIssuerDid, SdJwtVcIssuerX5c, SdJwtVcModule, type SdJwtVcPayload, SdJwtVcPresentOptions, SdJwtVcRecord, SdJwtVcRecordInstances, SdJwtVcRecordStorageProps, SdJwtVcRepository, SdJwtVcService, SdJwtVcSignOptions, SdJwtVcStoreOptions, SdJwtVcTypeMetadata, SdJwtVcTypeMetadataClaim, SdJwtVcTypeMetadataDisplay, SdJwtVcTypeMetadataRenderingMethodSimple, SdJwtVcTypeMetadataRenderingMethodSvgTemplate, SdJwtVcVerifyOptions, ServiceTransformer, Sha1, Sha256, Sha384, Sha512, SignatureSuiteRegistry, SignatureSuiteToken, type SimpleQuery, type SingleContextLruCacheItem, SingleContextLruCacheRecord, SingleContextStorageLruCache, type SingleContextStorageLruCacheOptions, type SingleOrArray, SingleValidationResult, StatusListCwt, type StatusListCwtOptions, StatusListInput, type StorageService, StorageUpdateService, StorageVersionRecord, StorageVersionRecordProps, StorageVersionRepository, SubmissionEntryCredential, SuiteInfo, Suites, TagValue, Tags, TagsBase, TokenStatusListApi, TokenStatusListFormat, TokenStatusListModule, TokenStatusListResult, TokenStatusListResultFor, TokenStatusListService, TrustedIssuer, TrustedIssuerContext, TrustedIssuerDid, TrustedIssuerX509, TrustedIssuersForVerificationContext, TrustedIssuersForVerificationResult, TypedArrayEncoder, type UnionToIntersection, type Update, UpdateAssistant, UpdateAssistantUpdateOptions, type UpdateConfig, UpdateTokenStatusListOptions, type UseInstanceFromCredentialRecordOptions, type UseInstanceFromCredentialRecordReturn, type V0_1ToV0_2UpdateConfig, VERIFIABLE_CREDENTIAL_TYPE, VERIFIABLE_PRESENTATION_TYPE, VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019, VERIFICATION_METHOD_TYPE_ED25519_VERIFICATION_KEY_2018, VERIFICATION_METHOD_TYPE_ED25519_VERIFICATION_KEY_2020, VERIFICATION_METHOD_TYPE_JSON_WEB_KEY_2020, VERIFICATION_METHOD_TYPE_MULTIKEY, VERIFICATION_METHOD_TYPE_X25519_KEY_AGREEMENT_KEY_2019, VerifiableCredential, VerifiablePresentation, VerificationMethod, VerificationMethodTransformer, VerificationResult, VerificationSigner, VerificationSignerDid, VerificationSignerX509, VerificationTypeCredential, VerificationTypeMdocReaderAuth, type VersionString, W3cCreatePresentationOptions, W3cCredential, W3cCredentialOptions, W3cCredentialRecord, W3cCredentialRecordInstances, W3cCredentialRecordOptions, W3cCredentialRepository, W3cCredentialSchema, W3cCredentialSchemaOptions, W3cCredentialService, W3cCredentialStatus, W3cCredentialStatusOptions, W3cCredentialSubject, W3cCredentialSubjectOptions, W3cCredentialSubjectTransformer, W3cCredentialsApi, W3cCredentialsModule, W3cCredentialsModuleConfig, W3cCredentialsModuleConfigOptions, W3cDataIntegrityApi, type W3cDataIntegrityCreateFailure, type W3cDataIntegrityCreateProofOptions, type W3cDataIntegrityCreateResult, type W3cDataIntegrityCreateSuccess, type W3cDataIntegrityCryptosuite, type W3cDataIntegrityCryptosuiteInfo, type W3cDataIntegrityCryptosuiteProof, type W3cDataIntegrityCryptosuiteProofOptions, type W3cDataIntegrityIssueList, W3cDataIntegrityModule, W3cDataIntegrityProcessingErrorCode, type W3cDataIntegrityProcessingIssue, type W3cDataIntegrityProofSet, type W3cDataIntegrityProofSetSecuredDocument, type W3cDataIntegritySecuredDocument, type W3cDataIntegritySingleProofSecuredDocument, type W3cDataIntegrityUnsecuredDocument, type W3cDataIntegrityVerifyFailure, type W3cDataIntegrityVerifyProofDocumentOptions, type W3cDataIntegrityVerifyProofOptions, type W3cDataIntegrityVerifyResult, type W3cDataIntegrityVerifySuccess, W3cIssuer, W3cIssuerOptions, W3cIssuerTransformer, W3cJsonCredential, W3cJsonLdCredentialService, W3cJsonLdDeriveProofOptions, W3cJsonLdSignCredentialOptions, W3cJsonLdSignPresentationOptions, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiableCredentialOptions, W3cJsonLdVerifiablePresentation, W3cJsonLdVerifiablePresentationOptions, W3cJsonLdVerifyCredentialOptions, W3cJsonLdVerifyPresentationOptions, W3cJsonPresentation, W3cJwtCredentialService, W3cJwtSignCredentialOptions, W3cJwtSignPresentationOptions, W3cJwtVerifiableCredential, W3cJwtVerifiableCredentialOptions, W3cJwtVerifiablePresentation, W3cJwtVerifiablePresentationOptions, W3cJwtVerifyCredentialOptions, W3cJwtVerifyPresentationOptions, W3cPresentation, W3cPresentationOptions, W3cSignCredentialOptions, W3cSignPresentationOptions, W3cStoreCredentialOptions, W3cV2Credential, W3cV2CredentialOptions, W3cV2CredentialRecord, W3cV2CredentialRecordInstances, W3cV2CredentialRecordOptions, W3cV2CredentialRepository, W3cV2CredentialSchema, W3cV2CredentialSchemaOptions, W3cV2CredentialService, W3cV2CredentialStatus, W3cV2CredentialStatusOptions, W3cV2CredentialSubject, W3cV2CredentialSubjectOptions, W3cV2CredentialsApi, W3cV2CredentialsModule, W3cV2CredentialsModuleConfig, W3cV2CredentialsModuleConfigOptions, W3cV2DataIntegrityContextValidationResult, W3cV2DataIntegrityContextValidator, W3cV2DataIntegrityCredentialService, W3cV2DataIntegrityIssue, W3cV2DataIntegrityPresentationCredentialEntry, W3cV2DataIntegrityResolvedPresentation, W3cV2DataIntegritySecuredCredential, W3cV2DataIntegritySecuredPresentation, W3cV2DataIntegrityVerifiableCredential, W3cV2DataIntegrityVerifiableCredentialOptions, W3cV2DataIntegrityVerifiablePresentation, W3cV2DataIntegrityVerifiablePresentationOptions, W3cV2DiSignCredentialOptions, W3cV2DiSignPresentationOptions, W3cV2DiVerifyCredentialOptions, W3cV2DiVerifyPresentationOptions, W3cV2EnvelopedVerifiableCredential, W3cV2EnvelopedVerifiableCredentialOptions, W3cV2EnvelopedVerifiableCredentialTransformer, W3cV2EnvelopedVerifiablePresentation, W3cV2EnvelopedVerifiablePresentationOptions, W3cV2Evidence, W3cV2EvidenceOptions, W3cV2Issuer, W3cV2IssuerOptions, W3cV2IssuerTransformer, W3cV2JsonCredential, W3cV2JsonDataIntegrityPresentationEntry, W3cV2JsonEnvelopedVerifiableCredentialEntry, W3cV2JsonEnvelopedVerifiablePresentationEntry, W3cV2JsonLocalizedValue, W3cV2JsonPresentation, W3cV2JsonPresentationCredentialEntry, W3cV2JwtCredentialService, W3cV2JwtSignCredentialOptions, W3cV2JwtSignPresentationOptions, W3cV2JwtVerifiableCredential, W3cV2JwtVerifiableCredentialOptions, W3cV2JwtVerifiablePresentation, W3cV2JwtVerifiablePresentationOptions, W3cV2JwtVerifyCredentialOptions, W3cV2JwtVerifyPresentationOptions, W3cV2LocalizedValue, W3cV2LocalizedValueOptions, W3cV2LocalizedValueTransformer, W3cV2Presentation, W3cV2PresentationCredentialEntry, W3cV2PresentationCredentialEntryOptions, W3cV2PresentationCredentialEntryResult, W3cV2PresentationCredentialEntryTransformer, W3cV2PresentationOptions, W3cV2RefreshService, W3cV2RefreshServiceOptions, W3cV2SdJwt, W3cV2SdJwtCredentialService, W3cV2SdJwtHeader, W3cV2SdJwtPayload, W3cV2SdJwtSignCredentialOptions, W3cV2SdJwtSignPresentationOptions, W3cV2SdJwtVcPresentOptions, W3cV2SdJwtVerifiableCredential, W3cV2SdJwtVerifiableCredentialOptions, W3cV2SdJwtVerifiablePresentation, W3cV2SdJwtVerifiablePresentationOptions, W3cV2SdJwtVerifyCredentialOptions, W3cV2SdJwtVerifyPresentationOptions, W3cV2SignCredentialOptions, W3cV2SignPresentationOptions, W3cV2StoreCredentialOptions, W3cV2TermsOfUse, W3cV2TermsOfUseOptions, W3cV2VerifiableCredential, W3cV2VerifiableCredentialOptions, W3cV2VerifiableCredentialTransformer, W3cV2VerifiablePresentation, W3cV2VerifiablePresentationOptions, W3cV2VerifiablePresentationTransformer, W3cV2VerifyCredentialOptions, W3cV2VerifyCredentialResult, W3cV2VerifyPresentationOptions, W3cV2VerifyPresentationResult, W3cVerifiableCredential, W3cVerifiableCredentialTransformer, W3cVerifiablePresentation, W3cVerifyCredentialOptions, W3cVerifyCredentialResult, W3cVerifyPresentationOptions, W3cVerifyPresentationResult, WebDidResolver, X509Api, X509Certificate, X509CertificateExtensionsOptions, X509CertificateIssuerAndSubjectOptions, X509CertificateOptions, X509CertificateRevocationList, X509CertificateRevocationListEntry, X509CertificateRevocationListEntryOptions, X509CertificateRevocationListEntryReason, X509CertificateRevocationListExtensionsOptions, X509CertificateSigningRequestExtensionsOptions, X509CertificateSingleValidationResult, X509CertificateValidations, X509CheckCertificateRevocationOptions, X509CreateCertificateChainOptions, X509CreateCertificateOptions, X509CreateCertificateRevocationListOptions, X509CreateCertificateSigningRequestOptions, X509CrlDistributionPoint, X509CrlExtensionIdentifier, X509CrlUnavailableError, X509Error, X509ExtendedKeyUsage, X509ExtensionIdentifier, X509FetchCertificateRevocationListOptions, X509GetLeafCertificateOptions, X509IssuingDistributionPoint, X509KeyUsage, X509Module, X509ModuleConfig, X509ModuleConfigOptions, X509ParseCertificateOptions, X509ParseCertificateRevocationListOptions, X509ParseCertificateSigningRequestOptions, X509RevocationCheckMode, X509RevocationCheckOptions, X509RevocationCheckResult, X509RevocationReason, X509RevocationService, X509Service, X509ValidateCertificateChainOptions, X509ValidationError, X509ValidationResult, X509VerificationContext, X509VerificationTrustedCertificates, X509VerificationTypeCredential, X509VerificationTypeMdocReaderAuth, X509VerificationTypeOauth2ClientAttestation, X509VerificationTypeOauth2SecuredAuthorizationRequest, X509VerificationTypeOpenId4VciCredentialIssuerMetadata, X509VerificationTypeOpenId4VciKeyAttestation, type XOR, ZodValidationError, asArray, canUseInstanceFromCredentialRecord, constants, convertLegacyTrustedCertificates, convertName, convertPublicKeyToX25519, createAuthorityKeyIdentifierExtension, createBasicConstraintsExtension, createCrlDistributionPointsExtension, createCrlEntryCertificateIssuerExtension, createCrlNumberExtension, createDeltaCrlIndicatorExtension, createExtendedKeyUsagesExtension, createIssuerAlternativeNameExtension, createIssuingDistributionPointExtension, createKeyUsagesExtension, createPeerDidDocumentFromServices, createSubjectAlternativeNameExtension, createSubjectKeyIdentifierExtension, dcqlGetPresentationsToCreate, decodeCursor, decodeSdJwt, decodeW3cV2VerifiableCredential, decodeW3cV2VerifiablePresentation, deepEquality, defaultDocumentLoader, deriveProof, didDocumentJsonToNumAlgo1Did, didDocumentToNumAlgo2Did, didDocumentToNumAlgo4Did, didKeyToEd25519PublicJwk, didKeyToVerkey, encodeCursor, equalsIgnoreOrder, equalsWithOrder, extractPresentationsWithDescriptorsFromSubmission, extractX509CertificatesFromJwt, filterContextCorrelationId, findMatchingEd25519Key, getAlternativeDidsForPeerDid, getApiForModuleByName, getDirFromFilePath, getDomainFromUrl, getEcdsaSecp256k1VerificationKey2019, getEd25519VerificationKey2018, getEd25519VerificationKey2020, getJsonWebKey2020, getKmsKeyIdForVerifiacationMethod, getMultikey, getNumAlgoFromPeerDid, getPublicJwkFromEcdsaSecp256k1VerificationKey2019, getPublicJwkFromEd25519VerificationKey2018, getPublicJwkFromEd25519VerificationKey2020, getPublicJwkFromJsonWebKey2020, getPublicJwkFromMultikey, getPublicJwkFromVerificationMethod, getPublicJwkFrommX25519KeyAgreementKey2019, getRegisteredModuleByInstance, getRegisteredModuleByName, getX25519KeyAgreementKey2019, inject, injectAll, injectable, isDid, isDidKey, isEcdsaSecp256k1VerificationKey2019, isEd25519VerificationKey2018, isEd25519VerificationKey2020, isEmbeddedDataIntegrityPresentationEntry, isEnvelopedVerifiableCredentialEntry, isEnvelopedVerifiablePresentationEntry, isJsonObject, isJsonWebKey2020, isMdocSupportedSignatureAlgorithm, isMultikey, isNonEmptyArray, isStorageUpToDate, isValidPeerDid, isX25519KeyAgreementKey2019, joinUriParts, jwaAlgorithmToKeySignParams, keyDidEd25519, keyDidX25519, keyParamsToJwaAlgorithm, legacyTrustedCertificatesToTrustedIssuers, mapDataIntegrityIssuesToCredoError, mapNonEmptyArray, parseDid, presentationFromDataUri, presentationToDataUri, publicJwkToCryptoKeyAlgorithm, purposes, recordToCursor, replaceError, sdJwtVcHasher, serviceTypes, suites, tryParseDid, useInstanceFromCredentialRecord, utils, validateW3cV2SdJwtDisclosureFrame, vcLibraries, verkeyToDidKey, verkeyToPublicJwk, w3cDate, x509SignatureAlgorithmToJwa };
|
|
315
315
|
//# sourceMappingURL=index.d.mts.map
|
package/build/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgHM"}
|
package/build/index.mjs
CHANGED
|
@@ -107,10 +107,10 @@ import { DidKey } from "./modules/dids/methods/key/DidKey.mjs";
|
|
|
107
107
|
import { KeyDidRegistrar } from "./modules/dids/methods/key/KeyDidRegistrar.mjs";
|
|
108
108
|
import { KeyDidResolver } from "./modules/dids/methods/key/KeyDidResolver.mjs";
|
|
109
109
|
import { createPeerDidDocumentFromServices } from "./modules/dids/methods/peer/createPeerDidDocumentFromServices.mjs";
|
|
110
|
-
import { didDocumentToNumAlgo4Did
|
|
110
|
+
import { didDocumentToNumAlgo4Did } from "./modules/dids/methods/peer/peerDidNumAlgo4.mjs";
|
|
111
111
|
import { PeerDidNumAlgo, getAlternativeDidsForPeerDid, getNumAlgoFromPeerDid, isValidPeerDid } from "./modules/dids/methods/peer/didPeer.mjs";
|
|
112
112
|
import { didDocumentJsonToNumAlgo1Did } from "./modules/dids/methods/peer/peerDidNumAlgo1.mjs";
|
|
113
|
-
import { didDocumentToNumAlgo2Did
|
|
113
|
+
import { didDocumentToNumAlgo2Did } from "./modules/dids/methods/peer/peerDidNumAlgo2.mjs";
|
|
114
114
|
import { PeerDidRegistrar } from "./modules/dids/methods/peer/PeerDidRegistrar.mjs";
|
|
115
115
|
import { PeerDidResolver } from "./modules/dids/methods/peer/PeerDidResolver.mjs";
|
|
116
116
|
import { WebDidResolver } from "./modules/dids/methods/web/WebDidResolver.mjs";
|
|
@@ -272,6 +272,6 @@ const utils = {
|
|
|
272
272
|
addSecondsToDate
|
|
273
273
|
};
|
|
274
274
|
//#endregion
|
|
275
|
-
export { ALL_REVOCATION_REASONS_MASK, ANONCREDS_DATA_INTEGRITY_CRYPTOSUITE, ANONCREDS_W3C_CREDENTIAL_CRYPTOSUITE, Agent, AgentConfig, AgentContext, AnonCredsDataIntegrityServiceSymbol, AnonCredsW3cCredentialProof, AnonCredsW3cCredentialServiceSymbol, BaseAgent, BaseLogger, BaseRecord, CREDENTIALS_CONTEXT_V1_URL, CREDENTIALS_CONTEXT_V2_URL, CREDENTIALS_ISSUER_URL, CacheModule, CacheModuleConfig, CachedStorageService, CertificateSigningRequest, ClaimFormat, ClassValidationError, ConsoleLogger, CredentialIssuancePurpose, CredentialMultiInstanceState, CredentialMultiInstanceUseMode, CredoError, CredoWebCrypto, CredoWebCryptoKey, DID_V1_CONTEXT_URL, DataIntegrityProof, DateOnly, DateTransformer, DcqlError, DcqlModule, DcqlService, DefaultAgentContextProvider, DependencyManager, DidCommV1Service, LegacyDidCommV2Service as DidCommV2Service, DidDocument, DidDocumentBuilder, DidDocumentRole, DidDocumentService, DidJwk, DidKey, DidRecord, DidRecordMetadataKeys, DidRegistrarService, DidRepository, DidResolverService, DidsApi, DidsModule, DidsModuleConfig, DifPresentationExchangeError, DifPresentationExchangeModule, DifPresentationExchangeService, PresentationSubmissionLocation as DifPresentationExchangeSubmissionLocation, ENVELOPED_VERIFIABLE_CREDENTIAL_TYPE, ENVELOPED_VERIFIABLE_PRESENTATION_TYPE, EXPANDED_TYPE_CREDENTIALS_CONTEXT_V1_VC_TYPE, Ed25519Signature2018, Ed25519Signature2020, EventEmitter, GenericRecord, GenericRecordsApi, GenericRecordsModule, Hasher, InMemoryLruCache, IndyAgentService, InjectionSymbols, IntegrityVerifier, IsEnvelopedVerifiableCredentialType, IsEnvelopedVerifiablePresentationType, IsStringOrInstance, IsStringOrInstanceOrArrayOfInstances, IsStringOrStringArray, IsStringOrVerificationMethod, IsUri, IsW3cCredentialSubject, IsW3cIssuer, IsW3cV2Issuer, JsonEncoder, JsonLdModule, JsonLdModuleConfig, JsonTransformer, JwkDidRegistrar, JwkDidResolver, JwsLinkedDataSignature, JwsService, Jwt, JwtPayload, KeyDidRegistrar, KeyDidResolver, kms_exports as Kms, LdKeyPair, LinkedDataProof, LogLevel, Mdoc, MdocApi, MdocDcApiService, MdocDeviceRequestNotSatisfiedError, MdocDeviceResponse, MdocError, MdocEventTypes, MdocModule, MdocRecord, MdocRepository, MdocService, MdocVerificationSessionExpiredError, MdocVerificationSessionRecord, MdocVerificationSessionRepository, MdocVerificationSessionState, MessageValidator, Metadata, MultiBaseEncoder, MultiHashEncoder, NON_DISCLOSEABLE_FIELDS, DidCommV2Service as NewDidCommV2Service, DidCommV2ServiceEndpoint as NewDidCommV2ServiceEndpoint, PeerDidNumAlgo, PeerDidRegistrar, PeerDidResolver, RecordDuplicateError, RecordNotFoundError, Repository, RepositoryEventTypes, SECURITY_CONTEXT_SECP256k1_URL, SECURITY_CONTEXT_URL, SECURITY_CONTEXT_V1_URL, SECURITY_CONTEXT_V2_URL, SECURITY_CONTEXT_V3_URL, SECURITY_ED25519_2018_CONTEXT_URL, SECURITY_ED25519_2020_CONTEXT_URL, SECURITY_JWS_CONTEXT_URL, SECURITY_PROOF_URL, SECURITY_SIGNATURE_URL, SECURITY_X25519_CONTEXT_URL, SdJwtVcApi, SdJwtVcError, SdJwtVcModule, SdJwtVcRecord, SdJwtVcRepository, SdJwtVcService, ServiceTransformer, Sha1, Sha256, Sha384, Sha512, SignatureSuiteRegistry, SignatureSuiteToken, SingleContextLruCacheRecord, SingleContextStorageLruCache, StatusListCwt, StorageUpdateService, StorageVersionRecord, StorageVersionRepository, TokenStatusListApi, TokenStatusListModule, TokenStatusListService, TrustedIssuerContext, TypedArrayEncoder, UpdateAssistant, VERIFIABLE_CREDENTIAL_TYPE, VERIFIABLE_PRESENTATION_TYPE, VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019, VERIFICATION_METHOD_TYPE_ED25519_VERIFICATION_KEY_2018, VERIFICATION_METHOD_TYPE_ED25519_VERIFICATION_KEY_2020, VERIFICATION_METHOD_TYPE_JSON_WEB_KEY_2020, VERIFICATION_METHOD_TYPE_MULTIKEY, VERIFICATION_METHOD_TYPE_X25519_KEY_AGREEMENT_KEY_2019, VerificationMethod, VerificationMethodTransformer, W3cCredential, W3cCredentialRecord, W3cCredentialRepository, W3cCredentialSchema, W3cCredentialService, W3cCredentialStatus, W3cCredentialSubject, W3cCredentialSubjectTransformer, W3cCredentialsApi, W3cCredentialsModule, W3cCredentialsModuleConfig, W3cDataIntegrityApi, W3cDataIntegrityModule, W3cDataIntegrityProcessingErrorCode, W3cIssuer, W3cIssuerTransformer, W3cJsonLdCredentialService, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation, W3cJwtCredentialService, W3cJwtVerifiableCredential, W3cJwtVerifiablePresentation, W3cPresentation, W3cV2Credential, W3cV2CredentialRecord, W3cV2CredentialRepository, W3cV2CredentialSchema, W3cV2CredentialService, W3cV2CredentialStatus, W3cV2CredentialSubject, W3cV2CredentialsApi, W3cV2CredentialsModule, W3cV2CredentialsModuleConfig, W3cV2DataIntegrityContextValidator, W3cV2DataIntegrityCredentialService, W3cV2DataIntegrityVerifiableCredential, W3cV2DataIntegrityVerifiablePresentation, W3cV2EnvelopedVerifiableCredential, W3cV2EnvelopedVerifiableCredentialTransformer, W3cV2EnvelopedVerifiablePresentation, W3cV2Evidence, W3cV2Issuer, W3cV2IssuerTransformer, W3cV2JwtCredentialService, W3cV2JwtVerifiableCredential, W3cV2JwtVerifiablePresentation, W3cV2LocalizedValue, W3cV2LocalizedValueTransformer, W3cV2Presentation, W3cV2PresentationCredentialEntryTransformer, W3cV2RefreshService, W3cV2SdJwtCredentialService, W3cV2SdJwtVerifiableCredential, W3cV2SdJwtVerifiablePresentation, W3cV2TermsOfUse, W3cV2VerifiableCredentialTransformer, W3cV2VerifiablePresentationTransformer, W3cVerifiableCredentialTransformer, WebDidResolver, X509Api, X509Certificate, X509CertificateRevocationList, X509CertificateRevocationListEntryReason, X509CrlExtensionIdentifier, X509CrlUnavailableError, X509Error, X509ExtendedKeyUsage, X509ExtensionIdentifier, X509KeyUsage, X509Module, X509ModuleConfig, X509RevocationCheckMode, X509RevocationReason, X509RevocationService, X509Service, X509ValidationError, ZodValidationError, asArray, canUseInstanceFromCredentialRecord, constants, convertLegacyTrustedCertificates, convertName, convertPublicKeyToX25519, createAuthorityKeyIdentifierExtension, createBasicConstraintsExtension, createCrlDistributionPointsExtension, createCrlEntryCertificateIssuerExtension, createCrlNumberExtension, createDeltaCrlIndicatorExtension, createExtendedKeyUsagesExtension, createIssuerAlternativeNameExtension, createIssuingDistributionPointExtension, createKeyUsagesExtension, createPeerDidDocumentFromServices, createSubjectAlternativeNameExtension, createSubjectKeyIdentifierExtension, dcqlGetPresentationsToCreate, decodeCursor, decodeSdJwt, decodeW3cV2VerifiableCredential, decodeW3cV2VerifiablePresentation, deepEquality, defaultDocumentLoader, deriveProof, didDocumentJsonToNumAlgo1Did, didDocumentToNumAlgo2Did, didDocumentToNumAlgo4Did, didKeyToEd25519PublicJwk, didKeyToVerkey,
|
|
275
|
+
export { ALL_REVOCATION_REASONS_MASK, ANONCREDS_DATA_INTEGRITY_CRYPTOSUITE, ANONCREDS_W3C_CREDENTIAL_CRYPTOSUITE, Agent, AgentConfig, AgentContext, AnonCredsDataIntegrityServiceSymbol, AnonCredsW3cCredentialProof, AnonCredsW3cCredentialServiceSymbol, BaseAgent, BaseLogger, BaseRecord, CREDENTIALS_CONTEXT_V1_URL, CREDENTIALS_CONTEXT_V2_URL, CREDENTIALS_ISSUER_URL, CacheModule, CacheModuleConfig, CachedStorageService, CertificateSigningRequest, ClaimFormat, ClassValidationError, ConsoleLogger, CredentialIssuancePurpose, CredentialMultiInstanceState, CredentialMultiInstanceUseMode, CredoError, CredoWebCrypto, CredoWebCryptoKey, DID_V1_CONTEXT_URL, DataIntegrityProof, DateOnly, DateTransformer, DcqlError, DcqlModule, DcqlService, DefaultAgentContextProvider, DependencyManager, DidCommV1Service, LegacyDidCommV2Service as DidCommV2Service, DidDocument, DidDocumentBuilder, DidDocumentRole, DidDocumentService, DidJwk, DidKey, DidRecord, DidRecordMetadataKeys, DidRegistrarService, DidRepository, DidResolverService, DidsApi, DidsModule, DidsModuleConfig, DifPresentationExchangeError, DifPresentationExchangeModule, DifPresentationExchangeService, PresentationSubmissionLocation as DifPresentationExchangeSubmissionLocation, ENVELOPED_VERIFIABLE_CREDENTIAL_TYPE, ENVELOPED_VERIFIABLE_PRESENTATION_TYPE, EXPANDED_TYPE_CREDENTIALS_CONTEXT_V1_VC_TYPE, Ed25519Signature2018, Ed25519Signature2020, EventEmitter, GenericRecord, GenericRecordsApi, GenericRecordsModule, Hasher, InMemoryLruCache, IndyAgentService, InjectionSymbols, IntegrityVerifier, IsEnvelopedVerifiableCredentialType, IsEnvelopedVerifiablePresentationType, IsStringOrInstance, IsStringOrInstanceOrArrayOfInstances, IsStringOrStringArray, IsStringOrVerificationMethod, IsUri, IsW3cCredentialSubject, IsW3cIssuer, IsW3cV2Issuer, JsonEncoder, JsonLdModule, JsonLdModuleConfig, JsonTransformer, JwkDidRegistrar, JwkDidResolver, JwsLinkedDataSignature, JwsService, Jwt, JwtPayload, KeyDidRegistrar, KeyDidResolver, kms_exports as Kms, LdKeyPair, LinkedDataProof, LogLevel, Mdoc, MdocApi, MdocDcApiService, MdocDeviceRequestNotSatisfiedError, MdocDeviceResponse, MdocError, MdocEventTypes, MdocModule, MdocRecord, MdocRepository, MdocService, MdocVerificationSessionExpiredError, MdocVerificationSessionRecord, MdocVerificationSessionRepository, MdocVerificationSessionState, MessageValidator, Metadata, MultiBaseEncoder, MultiHashEncoder, NON_DISCLOSEABLE_FIELDS, DidCommV2Service as NewDidCommV2Service, DidCommV2ServiceEndpoint as NewDidCommV2ServiceEndpoint, PeerDidNumAlgo, PeerDidRegistrar, PeerDidResolver, RecordDuplicateError, RecordNotFoundError, Repository, RepositoryEventTypes, SECURITY_CONTEXT_SECP256k1_URL, SECURITY_CONTEXT_URL, SECURITY_CONTEXT_V1_URL, SECURITY_CONTEXT_V2_URL, SECURITY_CONTEXT_V3_URL, SECURITY_ED25519_2018_CONTEXT_URL, SECURITY_ED25519_2020_CONTEXT_URL, SECURITY_JWS_CONTEXT_URL, SECURITY_PROOF_URL, SECURITY_SIGNATURE_URL, SECURITY_X25519_CONTEXT_URL, SdJwtVcApi, SdJwtVcError, SdJwtVcModule, SdJwtVcRecord, SdJwtVcRepository, SdJwtVcService, ServiceTransformer, Sha1, Sha256, Sha384, Sha512, SignatureSuiteRegistry, SignatureSuiteToken, SingleContextLruCacheRecord, SingleContextStorageLruCache, StatusListCwt, StorageUpdateService, StorageVersionRecord, StorageVersionRepository, TokenStatusListApi, TokenStatusListModule, TokenStatusListService, TrustedIssuerContext, TypedArrayEncoder, UpdateAssistant, VERIFIABLE_CREDENTIAL_TYPE, VERIFIABLE_PRESENTATION_TYPE, VERIFICATION_METHOD_TYPE_ECDSA_SECP256K1_VERIFICATION_KEY_2019, VERIFICATION_METHOD_TYPE_ED25519_VERIFICATION_KEY_2018, VERIFICATION_METHOD_TYPE_ED25519_VERIFICATION_KEY_2020, VERIFICATION_METHOD_TYPE_JSON_WEB_KEY_2020, VERIFICATION_METHOD_TYPE_MULTIKEY, VERIFICATION_METHOD_TYPE_X25519_KEY_AGREEMENT_KEY_2019, VerificationMethod, VerificationMethodTransformer, W3cCredential, W3cCredentialRecord, W3cCredentialRepository, W3cCredentialSchema, W3cCredentialService, W3cCredentialStatus, W3cCredentialSubject, W3cCredentialSubjectTransformer, W3cCredentialsApi, W3cCredentialsModule, W3cCredentialsModuleConfig, W3cDataIntegrityApi, W3cDataIntegrityModule, W3cDataIntegrityProcessingErrorCode, W3cIssuer, W3cIssuerTransformer, W3cJsonLdCredentialService, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation, W3cJwtCredentialService, W3cJwtVerifiableCredential, W3cJwtVerifiablePresentation, W3cPresentation, W3cV2Credential, W3cV2CredentialRecord, W3cV2CredentialRepository, W3cV2CredentialSchema, W3cV2CredentialService, W3cV2CredentialStatus, W3cV2CredentialSubject, W3cV2CredentialsApi, W3cV2CredentialsModule, W3cV2CredentialsModuleConfig, W3cV2DataIntegrityContextValidator, W3cV2DataIntegrityCredentialService, W3cV2DataIntegrityVerifiableCredential, W3cV2DataIntegrityVerifiablePresentation, W3cV2EnvelopedVerifiableCredential, W3cV2EnvelopedVerifiableCredentialTransformer, W3cV2EnvelopedVerifiablePresentation, W3cV2Evidence, W3cV2Issuer, W3cV2IssuerTransformer, W3cV2JwtCredentialService, W3cV2JwtVerifiableCredential, W3cV2JwtVerifiablePresentation, W3cV2LocalizedValue, W3cV2LocalizedValueTransformer, W3cV2Presentation, W3cV2PresentationCredentialEntryTransformer, W3cV2RefreshService, W3cV2SdJwtCredentialService, W3cV2SdJwtVerifiableCredential, W3cV2SdJwtVerifiablePresentation, W3cV2TermsOfUse, W3cV2VerifiableCredentialTransformer, W3cV2VerifiablePresentationTransformer, W3cVerifiableCredentialTransformer, WebDidResolver, X509Api, X509Certificate, X509CertificateRevocationList, X509CertificateRevocationListEntryReason, X509CrlExtensionIdentifier, X509CrlUnavailableError, X509Error, X509ExtendedKeyUsage, X509ExtensionIdentifier, X509KeyUsage, X509Module, X509ModuleConfig, X509RevocationCheckMode, X509RevocationReason, X509RevocationService, X509Service, X509ValidationError, ZodValidationError, asArray, canUseInstanceFromCredentialRecord, constants, convertLegacyTrustedCertificates, convertName, convertPublicKeyToX25519, createAuthorityKeyIdentifierExtension, createBasicConstraintsExtension, createCrlDistributionPointsExtension, createCrlEntryCertificateIssuerExtension, createCrlNumberExtension, createDeltaCrlIndicatorExtension, createExtendedKeyUsagesExtension, createIssuerAlternativeNameExtension, createIssuingDistributionPointExtension, createKeyUsagesExtension, createPeerDidDocumentFromServices, createSubjectAlternativeNameExtension, createSubjectKeyIdentifierExtension, dcqlGetPresentationsToCreate, decodeCursor, decodeSdJwt, decodeW3cV2VerifiableCredential, decodeW3cV2VerifiablePresentation, deepEquality, defaultDocumentLoader, deriveProof, didDocumentJsonToNumAlgo1Did, didDocumentToNumAlgo2Did, didDocumentToNumAlgo4Did, didKeyToEd25519PublicJwk, didKeyToVerkey, encodeCursor, equalsIgnoreOrder, equalsWithOrder, extractPresentationsWithDescriptorsFromSubmission, extractX509CertificatesFromJwt, filterContextCorrelationId, findMatchingEd25519Key, getAlternativeDidsForPeerDid, getApiForModuleByName, getDirFromFilePath, getDomainFromUrl, getEcdsaSecp256k1VerificationKey2019, getEd25519VerificationKey2018, getEd25519VerificationKey2020, getJsonWebKey2020, getKmsKeyIdForVerifiacationMethod, getMultikey, getNumAlgoFromPeerDid, getPublicJwkFromEcdsaSecp256k1VerificationKey2019, getPublicJwkFromEd25519VerificationKey2018, getPublicJwkFromEd25519VerificationKey2020, getPublicJwkFromJsonWebKey2020, getPublicJwkFromMultikey, getPublicJwkFromVerificationMethod, getPublicJwkFrommX25519KeyAgreementKey2019, getRegisteredModuleByInstance, getRegisteredModuleByName, getX25519KeyAgreementKey2019, inject, injectAll, injectable, isDid, isDidKey, isEcdsaSecp256k1VerificationKey2019, isEd25519VerificationKey2018, isEd25519VerificationKey2020, isEmbeddedDataIntegrityPresentationEntry, isEnvelopedVerifiableCredentialEntry, isEnvelopedVerifiablePresentationEntry, isJsonObject, isJsonWebKey2020, isMdocSupportedSignatureAlgorithm, isMultikey, isNonEmptyArray, isStorageUpToDate, isValidPeerDid, isX25519KeyAgreementKey2019, joinUriParts, jwaAlgorithmToKeySignParams, keyDidEd25519, keyDidX25519, keyParamsToJwaAlgorithm, legacyTrustedCertificatesToTrustedIssuers, mapDataIntegrityIssuesToCredoError, mapNonEmptyArray, parseDid, presentationFromDataUri, presentationToDataUri, publicJwkToCryptoKeyAlgorithm, purposes, recordToCursor, replaceError, sdJwtVcHasher, serviceTypes, suites, tryParseDid, useInstanceFromCredentialRecord, utils, validateW3cV2SdJwtDisclosureFrame, vcLibraries, verkeyToDidKey, verkeyToPublicJwk, w3cDate, x509SignatureAlgorithmToJwa };
|
|
276
276
|
|
|
277
277
|
//# sourceMappingURL=index.mjs.map
|
package/build/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["// reflect-metadata used for class-transformer + class-validator\nimport 'reflect-metadata'\n\nexport * from './agent'\nexport { Agent } from './agent/Agent'\nexport { AgentConfig } from './agent/AgentConfig'\nexport type { AgentDependencies } from './agent/AgentDependencies'\nexport type { AgentApi, DefaultAgentModules, EmptyModuleMap, ModulesMap } from './agent/AgentModules'\nexport { BaseAgent } from './agent/BaseAgent'\nexport { EventEmitter } from './agent/EventEmitter'\nexport * from './agent/Events'\nexport { TrustedIssuerContext } from './agent/TrustedIssuerContext'\nexport * from './agent/TrustedIssuersForVerification'\nexport { InjectionSymbols } from './constants'\nexport * from './crypto'\nexport * from './error'\nexport * from './logger'\nexport * from './modules/cache'\nexport * from './modules/dcql'\nexport * from './modules/dids'\nexport { tryParseDid } from './modules/dids/domain/parse'\n// TODO: Clean up these exports used by DIDComm module\nexport {\n didKeyToEd25519PublicJwk,\n didKeyToVerkey,\n isDidKey,\n verkeyToDidKey,\n verkeyToPublicJwk,\n} from './modules/dids/helpers'\nexport { didDocumentJsonToNumAlgo1Did } from './modules/dids/methods/peer/peerDidNumAlgo1'\nexport {
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["// reflect-metadata used for class-transformer + class-validator\nimport 'reflect-metadata'\n\nexport * from './agent'\nexport { Agent } from './agent/Agent'\nexport { AgentConfig } from './agent/AgentConfig'\nexport type { AgentDependencies } from './agent/AgentDependencies'\nexport type { AgentApi, DefaultAgentModules, EmptyModuleMap, ModulesMap } from './agent/AgentModules'\nexport { BaseAgent } from './agent/BaseAgent'\nexport { EventEmitter } from './agent/EventEmitter'\nexport * from './agent/Events'\nexport { TrustedIssuerContext } from './agent/TrustedIssuerContext'\nexport * from './agent/TrustedIssuersForVerification'\nexport { InjectionSymbols } from './constants'\nexport * from './crypto'\nexport * from './error'\nexport * from './logger'\nexport * from './modules/cache'\nexport * from './modules/dcql'\nexport * from './modules/dids'\nexport { tryParseDid } from './modules/dids/domain/parse'\n// TODO: Clean up these exports used by DIDComm module\nexport {\n didKeyToEd25519PublicJwk,\n didKeyToVerkey,\n isDidKey,\n verkeyToDidKey,\n verkeyToPublicJwk,\n} from './modules/dids/helpers'\nexport { didDocumentJsonToNumAlgo1Did } from './modules/dids/methods/peer/peerDidNumAlgo1'\nexport { didDocumentToNumAlgo2Did } from './modules/dids/methods/peer/peerDidNumAlgo2'\nexport { didDocumentToNumAlgo4Did } from './modules/dids/methods/peer/peerDidNumAlgo4'\nexport { DidRecordMetadataKeys } from './modules/dids/repository/didRecordMetadataTypes'\nexport * from './modules/dif-presentation-exchange'\nexport * from './modules/generic-records'\n/**\n * @deprecated import from `@credo-ts/core/kms` instead\n */\nexport * as Kms from './modules/kms'\nexport * from './modules/mdoc'\nexport * from './modules/sd-jwt-vc'\nexport * from './modules/token-status-list'\nexport * from './modules/vc'\nexport * from './modules/w3c-di'\nexport * from './modules/x509'\nexport * from './plugins'\nexport * from './storage/BaseRecord'\nexport type { DownloadToFileOptions, FileSystem } from './storage/FileSystem'\nexport { Metadata, type MetadataBase } from './storage/Metadata'\nexport * from './storage/migration'\nexport type { UpdateConfig, V0_1ToV0_2UpdateConfig } from './storage/migration/updates'\nexport { Repository } from './storage/Repository'\nexport * from './storage/RepositoryEvents'\nexport type {\n BaseRecordConstructor,\n Query,\n QueryOptions,\n SimpleQuery,\n StorageService,\n} from './storage/StorageService'\nexport { decodeCursor, encodeCursor, recordToCursor } from './storage/StorageService'\nexport type {\n CanBePromise,\n InitConfig,\n JsonArray,\n JsonObject,\n JsonValue,\n NonEmptyArray,\n Optional,\n ResolvedDidCommService,\n SingleOrArray,\n XOR,\n} from './types'\nexport { isJsonObject, isNonEmptyArray, mapNonEmptyArray } from './types'\nexport {\n asArray,\n type BaseName,\n DateTransformer,\n deepEquality,\n equalsIgnoreOrder,\n equalsWithOrder,\n IntegrityVerifier,\n IsStringOrInstance,\n IsStringOrInstanceOrArrayOfInstances,\n IsStringOrStringArray,\n IsUri,\n isDid,\n JsonEncoder,\n JsonTransformer,\n MessageValidator,\n MultiBaseEncoder,\n MultiHashEncoder,\n TypedArrayEncoder,\n} from './utils'\nexport type {\n CredentialMultiInstanceUseUpdateMode,\n UseInstanceFromCredentialRecordOptions,\n UseInstanceFromCredentialRecordReturn,\n} from './utils/credentialUse'\nexport { canUseInstanceFromCredentialRecord, useInstanceFromCredentialRecord } from './utils/credentialUse'\nexport { CredentialMultiInstanceState, CredentialMultiInstanceUseMode } from './utils/credentialUseTypes'\nexport { getDomainFromUrl } from './utils/domain'\nexport type { Constructable, Constructor, UnionToIntersection } from './utils/mixins'\nexport { getDirFromFilePath, joinUriParts } from './utils/path'\nexport type { VersionString } from './utils/version'\n\nimport { indyDidFromPublicKeyBase58 } from './utils/did'\nimport { areObjectsEqual } from './utils/objectEquality'\nimport timestamp, { addSecondsToDate, dateToSeconds, nowInSeconds } from './utils/timestamp'\nimport { getProtocolScheme } from './utils/uri'\nimport { isValidUuid, uuid } from './utils/uuid'\n\nconst utils = {\n areObjectsEqual,\n uuid,\n isValidUuid,\n getProtocolScheme,\n timestamp,\n indyDidFromPublicKeyBase58,\n nowInSeconds,\n dateToSeconds,\n addSecondsToDate,\n}\n\nexport { utils }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgHA,MAAM,QAAQ;CACZ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import { P256PublicJwk } from "../../kms/jwk/kty/ec/P256PublicJwk.mjs";
|
|
2
|
-
import { P384PublicJwk } from "../../kms/jwk/kty/ec/P384PublicJwk.mjs";
|
|
3
1
|
import { Ed25519PublicJwk } from "../../kms/jwk/kty/okp/Ed25519PublicJwk.mjs";
|
|
4
2
|
import { X25519PublicJwk } from "../../kms/jwk/kty/okp/X25519PublicJwk.mjs";
|
|
5
3
|
import { PublicJwk } from "../../kms/jwk/PublicJwk.mjs";
|
|
6
4
|
import "../../kms/index.mjs";
|
|
7
5
|
import { DidDocumentService } from "./service/DidDocumentService.mjs";
|
|
8
6
|
import { DidCommV1Service } from "./service/DidCommV1Service.mjs";
|
|
9
|
-
import { DidCommV2Service } from "./service/DidCommV2Service.mjs";
|
|
10
7
|
import { IndyAgentService } from "./service/IndyAgentService.mjs";
|
|
11
|
-
import { LegacyDidCommV2Service } from "./service/LegacyDidCommV2Service.mjs";
|
|
12
8
|
import "./service/index.mjs";
|
|
13
9
|
import { VerificationMethod } from "./verificationMethod/VerificationMethod.mjs";
|
|
14
10
|
import "./verificationMethod/index.mjs";
|
|
@@ -63,8 +59,8 @@ export declare class DidDocument {
|
|
|
63
59
|
* Get all DIDComm services ordered by priority descending. This means the highest
|
|
64
60
|
* priority will be the first entry.
|
|
65
61
|
*/
|
|
66
|
-
get didCommServices(): Array<IndyAgentService | DidCommV1Service
|
|
67
|
-
get recipientKeys(): PublicJwk<Ed25519PublicJwk | X25519PublicJwk
|
|
62
|
+
get didCommServices(): Array<IndyAgentService | DidCommV1Service>;
|
|
63
|
+
get recipientKeys(): PublicJwk<Ed25519PublicJwk | X25519PublicJwk>[];
|
|
68
64
|
/**
|
|
69
65
|
* Returns the recipient keys with their verification method matches
|
|
70
66
|
*
|
|
@@ -74,7 +70,7 @@ export declare class DidDocument {
|
|
|
74
70
|
mapX25519ToEd25519: MapX25519ToEd25519;
|
|
75
71
|
}): Array<{
|
|
76
72
|
verificationMethod: VerificationMethod;
|
|
77
|
-
publicJwk: PublicJwk<
|
|
73
|
+
publicJwk: PublicJwk<MapX25519ToEd25519 extends true ? Ed25519PublicJwk : Ed25519PublicJwk | X25519PublicJwk>;
|
|
78
74
|
}>;
|
|
79
75
|
toJSON(): Record<string, any>;
|
|
80
76
|
static fromJSON(didDocument: unknown): DidDocument;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidDocument.d.mts","names":[],"sources":["../../../../src/modules/dids/domain/DidDocument.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DidDocument.d.mts","names":[],"sources":["../../../../src/modules/dids/domain/DidDocument.ts"],"mappings":";;;;;;;;;;;YAcY;KAOP,yBAAyB;UAEpB;EACR;EACA;EACA;EACA;EACA,qBAAqB;EACrB,UAAU;EACV,iBAAiB,eAAe;EAChC,kBAAkB,eAAe;EACjC,eAAe,eAAe;EAC9B,uBAAuB,eAAe;EACtC,uBAAuB,eAAe;;qBAG3B;EAGJ;EAGA;EAKA;EAIA;EAMA,qBAAqB;EAKrB,UAAU;EAMV,iBAAiB,eAAe;EAMhC,kBAAkB,eAAe;EAMjC,eAAe,eAAe;EAM9B,uBAAuB,eAAe;EAMtC,uBAAuB,eAAe;EAE1B,YAAA,SAAS;EAgBrB,8BAA8B,gBAAa;EAa3C,eAAe,eAAe,kBAAkB,2BAAwB;EA0BxE,iCAAiC,0BAA0B,2BAA2B;EAYtF,wCACL,qDACA,0BAA0B,2BACzB;UAQK;EAUD,kCAAkC,WAAW,WAAW,kBAAkB,2BAAwB;;;;;;EA6BlG,kBAAkB,UAAU,qBAAqB,oBAAoB,eAAe;;;;;;EASpF,uBAAuB,UAAU,qBAAqB,oBAC3D,mBAAmB,kBAAkB,IACpC;;;;;MAQQ,mBAAmB,MAAM,mBAAmB;MAW5C,iBAAiB,UAAU,mBAAmB;;;;;;EAYlD,uCAAuC,sCAC5C;IAEA,oBAAoB;MAClB;IACF,oBAAoB;IACpB,WAAW,UAAU,kCAAkC,mBAAmB,mBAAmB;;EAoFxF,UAAM;SAIC,SAAS,uBAAoB"}
|
|
@@ -6,8 +6,6 @@ import { IsStringOrStringArray } from "../../../utils/transformers.mjs";
|
|
|
6
6
|
import "../../../utils/index.mjs";
|
|
7
7
|
import __decorateMetadata from "../../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.mjs";
|
|
8
8
|
import __decorate from "../../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.mjs";
|
|
9
|
-
import { P256PublicJwk } from "../../kms/jwk/kty/ec/P256PublicJwk.mjs";
|
|
10
|
-
import { P384PublicJwk } from "../../kms/jwk/kty/ec/P384PublicJwk.mjs";
|
|
11
9
|
import { X25519PublicJwk } from "../../kms/jwk/kty/okp/X25519PublicJwk.mjs";
|
|
12
10
|
import { Ed25519PublicJwk } from "../../kms/jwk/kty/okp/Ed25519PublicJwk.mjs";
|
|
13
11
|
import { PublicJwk } from "../../kms/jwk/PublicJwk.mjs";
|
|
@@ -19,9 +17,7 @@ import { getPublicJwkFromVerificationMethod } from "./key-type/keyDidMapping.mjs
|
|
|
19
17
|
import { findMatchingEd25519Key } from "../findMatchingEd25519Key.mjs";
|
|
20
18
|
import "./key-type/index.mjs";
|
|
21
19
|
import { DidCommV1Service } from "./service/DidCommV1Service.mjs";
|
|
22
|
-
import { DidCommV2Service } from "./service/DidCommV2Service.mjs";
|
|
23
20
|
import { IndyAgentService } from "./service/IndyAgentService.mjs";
|
|
24
|
-
import { LegacyDidCommV2Service } from "./service/LegacyDidCommV2Service.mjs";
|
|
25
21
|
import { ServiceTransformer } from "./service/ServiceTransformer.mjs";
|
|
26
22
|
import "./service/index.mjs";
|
|
27
23
|
import { Expose, Type } from "class-transformer";
|
|
@@ -112,15 +108,8 @@ var DidDocument = class DidDocument {
|
|
|
112
108
|
* priority will be the first entry.
|
|
113
109
|
*/
|
|
114
110
|
get didCommServices() {
|
|
115
|
-
const didCommServiceTypes = [
|
|
116
|
-
|
|
117
|
-
DidCommV1Service.type,
|
|
118
|
-
LegacyDidCommV2Service.type,
|
|
119
|
-
DidCommV2Service.type
|
|
120
|
-
];
|
|
121
|
-
const services = this.service?.filter((service) => didCommServiceTypes.includes(service.type)) ?? [];
|
|
122
|
-
const getPriority = (service) => service instanceof IndyAgentService || service instanceof DidCommV1Service ? service.priority : 0;
|
|
123
|
-
return services.sort((a, b) => getPriority(a) - getPriority(b));
|
|
111
|
+
const didCommServiceTypes = [IndyAgentService.type, DidCommV1Service.type];
|
|
112
|
+
return (this.service?.filter((service) => didCommServiceTypes.includes(service.type)) ?? []).sort((a, b) => a.priority - b.priority);
|
|
124
113
|
}
|
|
125
114
|
get recipientKeys() {
|
|
126
115
|
return this.getRecipientKeysWithVerificationMethod({ mapX25519ToEd25519: false }).map(({ publicJwk }) => publicJwk);
|
|
@@ -133,7 +122,7 @@ var DidDocument = class DidDocument {
|
|
|
133
122
|
getRecipientKeysWithVerificationMethod({ mapX25519ToEd25519 }) {
|
|
134
123
|
const recipientKeys = [];
|
|
135
124
|
const seenVerificationMethodIds = [];
|
|
136
|
-
for (const service of this.didCommServices) if (service
|
|
125
|
+
for (const service of this.didCommServices) if (service.type === IndyAgentService.type) for (const publicKeyBase58 of service.recipientKeys) {
|
|
137
126
|
const publicJwk = PublicJwk.fromPublicKey({
|
|
138
127
|
kty: "OKP",
|
|
139
128
|
crv: "Ed25519",
|
|
@@ -148,9 +137,8 @@ var DidDocument = class DidDocument {
|
|
|
148
137
|
publicJwk,
|
|
149
138
|
verificationMethod
|
|
150
139
|
});
|
|
151
|
-
seenVerificationMethodIds.push(verificationMethod.id);
|
|
152
140
|
}
|
|
153
|
-
else if (service
|
|
141
|
+
else if (service.type === DidCommV1Service.type) for (const recipientKey of service.recipientKeys) {
|
|
154
142
|
const verificationMethod = this.dereferenceKey(recipientKey, ["authentication", "keyAgreement"]);
|
|
155
143
|
if (seenVerificationMethodIds.includes(verificationMethod.id)) continue;
|
|
156
144
|
const publicJwk = getPublicJwkFromVerificationMethod(verificationMethod);
|
|
@@ -159,28 +147,16 @@ var DidDocument = class DidDocument {
|
|
|
159
147
|
publicJwk,
|
|
160
148
|
verificationMethod
|
|
161
149
|
});
|
|
162
|
-
seenVerificationMethodIds.push(verificationMethod.id);
|
|
163
|
-
}
|
|
164
|
-
else if (service instanceof LegacyDidCommV2Service || service instanceof DidCommV2Service) for (const keyRef of this.keyAgreement ?? []) {
|
|
165
|
-
const verificationMethod = typeof keyRef === "string" ? this.dereferenceVerificationMethod(keyRef) : keyRef;
|
|
166
|
-
if (seenVerificationMethodIds.includes(verificationMethod.id)) continue;
|
|
167
|
-
const publicJwk = getPublicJwkFromVerificationMethod(verificationMethod);
|
|
168
|
-
if (!publicJwk.is(Ed25519PublicJwk, X25519PublicJwk, P256PublicJwk, P384PublicJwk)) continue;
|
|
169
|
-
recipientKeys.push({
|
|
170
|
-
publicJwk,
|
|
171
|
-
verificationMethod
|
|
172
|
-
});
|
|
173
|
-
seenVerificationMethodIds.push(verificationMethod.id);
|
|
174
150
|
}
|
|
175
151
|
if (!mapX25519ToEd25519) return recipientKeys;
|
|
176
|
-
return recipientKeys.
|
|
177
|
-
if (publicJwk.is(Ed25519PublicJwk
|
|
152
|
+
return recipientKeys.map(({ publicJwk, verificationMethod }) => {
|
|
153
|
+
if (publicJwk.is(Ed25519PublicJwk)) return {
|
|
178
154
|
publicJwk,
|
|
179
155
|
verificationMethod
|
|
180
|
-
}
|
|
156
|
+
};
|
|
181
157
|
const matchingEd25519Key = findMatchingEd25519Key(publicJwk, this);
|
|
182
158
|
if (!matchingEd25519Key) throw new CredoError(`Unable to find matching Ed25519 key for X25519 verification method with id ${verificationMethod.id}`);
|
|
183
|
-
return
|
|
159
|
+
return matchingEd25519Key;
|
|
184
160
|
});
|
|
185
161
|
}
|
|
186
162
|
toJSON() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidDocument.mjs","names":["DidCommV2Service","NewDidCommV2Service"],"sources":["../../../../src/modules/dids/domain/DidDocument.ts"],"sourcesContent":["import { Expose, Type } from 'class-transformer'\nimport { IsArray, IsOptional, IsString, ValidateNested } from 'class-validator'\nimport { CredoError } from '../../../error'\nimport { TypedArrayEncoder } from '../../../utils'\nimport { JsonTransformer } from '../../../utils/JsonTransformer'\nimport { IsStringOrStringArray } from '../../../utils/transformers'\nimport { Ed25519PublicJwk, P256PublicJwk, P384PublicJwk, PublicJwk, X25519PublicJwk } from '../../kms'\nimport { findMatchingEd25519Key } from '../findMatchingEd25519Key'\nimport { getPublicJwkFromVerificationMethod } from './key-type'\nimport type { DidDocumentService } from './service'\nimport { DidCommV1Service, DidCommV2Service, IndyAgentService, NewDidCommV2Service } from './service'\nimport { ServiceTransformer } from './service/ServiceTransformer'\nimport { IsStringOrVerificationMethod, VerificationMethod, VerificationMethodTransformer } from './verificationMethod'\n\nexport type DidPurpose =\n | 'authentication'\n | 'keyAgreement'\n | 'assertionMethod'\n | 'capabilityInvocation'\n | 'capabilityDelegation'\n\ntype DidVerificationMethods = DidPurpose | 'verificationMethod'\n\ninterface DidDocumentOptions {\n context?: string | string[]\n id: string\n alsoKnownAs?: string[]\n controller?: string | string[]\n verificationMethod?: VerificationMethod[]\n service?: DidDocumentService[]\n authentication?: Array<string | VerificationMethod>\n assertionMethod?: Array<string | VerificationMethod>\n keyAgreement?: Array<string | VerificationMethod>\n capabilityInvocation?: Array<string | VerificationMethod>\n capabilityDelegation?: Array<string | VerificationMethod>\n}\n\nexport class DidDocument {\n @Expose({ name: '@context' })\n @IsStringOrStringArray()\n public context: string | string[] = ['https://www.w3.org/ns/did/v1']\n\n @IsString()\n public id!: string\n\n @IsArray()\n @IsString({ each: true })\n @IsOptional()\n public alsoKnownAs?: string[]\n\n @IsStringOrStringArray()\n @IsOptional()\n public controller?: string | string[]\n\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => VerificationMethod)\n @IsOptional()\n public verificationMethod?: VerificationMethod[]\n\n @IsArray()\n @ServiceTransformer()\n @IsOptional()\n public service?: DidDocumentService[]\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public authentication?: Array<string | VerificationMethod>\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public assertionMethod?: Array<string | VerificationMethod>\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public keyAgreement?: Array<string | VerificationMethod>\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public capabilityInvocation?: Array<string | VerificationMethod>\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public capabilityDelegation?: Array<string | VerificationMethod>\n\n public constructor(options: DidDocumentOptions) {\n if (options) {\n this.context = options.context ?? this.context\n this.id = options.id\n this.alsoKnownAs = options.alsoKnownAs\n this.controller = options.controller\n this.verificationMethod = options.verificationMethod\n this.service = options.service\n this.authentication = options.authentication\n this.assertionMethod = options.assertionMethod\n this.keyAgreement = options.keyAgreement\n this.capabilityInvocation = options.capabilityInvocation\n this.capabilityDelegation = options.capabilityDelegation\n }\n }\n\n public dereferenceVerificationMethod(keyId: string) {\n // TODO: once we use JSON-LD we should use that to resolve references in did documents.\n // for now we check whether the key id ends with the keyId.\n // so if looking for #123 and key.id is did:key:123#123, it is valid. But #123 as key.id is also valid\n const verificationMethod = this.verificationMethod?.find((key) => this.matchKeyId(keyId, key.id))\n\n if (!verificationMethod) {\n throw new CredoError(`Unable to locate verification method with id '${keyId}'`)\n }\n\n return verificationMethod\n }\n\n public dereferenceKey(keyId: string, allowedPurposes?: DidVerificationMethods[]) {\n const allPurposes: DidVerificationMethods[] = [\n 'authentication',\n 'keyAgreement',\n 'assertionMethod',\n 'capabilityInvocation',\n 'capabilityDelegation',\n 'verificationMethod',\n ]\n\n const purposes = allowedPurposes ?? allPurposes\n\n for (const purpose of purposes) {\n for (const key of this[purpose] ?? []) {\n if (typeof key === 'string' && this.matchKeyId(keyId, key)) {\n return this.dereferenceVerificationMethod(key)\n }\n if (typeof key !== 'string' && this.matchKeyId(keyId, key.id)) {\n return key\n }\n }\n }\n\n throw new CredoError(`Unable to locate verification method with id '${keyId}' in purposes ${purposes}`)\n }\n\n public findVerificationMethodsByPurpose(allowedPurposes: readonly DidVerificationMethods[]): VerificationMethod[] {\n const methods: VerificationMethod[] = []\n\n for (const purpose of allowedPurposes) {\n for (const entry of this[purpose] ?? []) {\n methods.push(typeof entry === 'string' ? this.dereferenceVerificationMethod(entry) : entry)\n }\n }\n\n return methods\n }\n\n public findVerificationMethodsByTypeAndPurpose(\n verificationMethodTypes: string | readonly string[],\n allowedPurposes: readonly DidVerificationMethods[]\n ): VerificationMethod[] {\n const acceptedTypes = new Set(\n typeof verificationMethodTypes === 'string' ? [verificationMethodTypes] : verificationMethodTypes\n )\n\n return this.findVerificationMethodsByPurpose(allowedPurposes).filter((method) => acceptedTypes.has(method.type))\n }\n\n private matchKeyId(externalKeyId: string, didDocumentKeyId: string) {\n // Compact is did removed from start but only if it matches the id of this document.\n const compactExternalKeyId = externalKeyId.startsWith(this.id) ? externalKeyId.slice(this.id.length) : externalKeyId\n const compactDidDocumentKeyId = didDocumentKeyId.startsWith(this.id)\n ? didDocumentKeyId.slice(this.id.length)\n : didDocumentKeyId\n\n return compactExternalKeyId === compactDidDocumentKeyId\n }\n\n public findVerificationMethodByPublicKey(publicJwk: PublicJwk, allowedPurposes?: DidVerificationMethods[]) {\n const allPurposes: DidVerificationMethods[] = [\n 'authentication',\n 'keyAgreement',\n 'assertionMethod',\n 'capabilityInvocation',\n 'capabilityDelegation',\n 'verificationMethod',\n ]\n\n const purposes = allowedPurposes ?? allPurposes\n\n for (const purpose of purposes) {\n for (const key of this[purpose] ?? []) {\n const verificationMethod = typeof key === 'string' ? this.dereferenceVerificationMethod(key) : key\n if (getPublicJwkFromVerificationMethod(verificationMethod).equals(publicJwk)) return verificationMethod\n }\n }\n\n throw new CredoError(\n `Unable to locate verification method with public key ${publicJwk.jwkTypeHumanDescription} in purposes ${purposes}`\n )\n }\n\n /**\n * Returns all of the service endpoints matching the given type.\n *\n * @param type The type of service(s) to query.\n */\n public getServicesByType<S extends DidDocumentService = DidDocumentService>(type: string): S[] {\n return (this.service?.filter((service) => service.type === type) ?? []) as S[]\n }\n\n /**\n * Returns all of the service endpoints matching the given class\n *\n * @param classType The class to query services.\n */\n public getServicesByClassType<S extends DidDocumentService = DidDocumentService>(\n classType: new (...args: never[]) => S\n ): S[] {\n return (this.service?.filter((service) => service instanceof classType) ?? []) as S[]\n }\n\n /**\n * Get all DIDComm services ordered by priority descending. This means the highest\n * priority will be the first entry.\n */\n public get didCommServices(): Array<IndyAgentService | DidCommV1Service | DidCommV2Service | NewDidCommV2Service> {\n const didCommServiceTypes = [\n IndyAgentService.type,\n DidCommV1Service.type,\n DidCommV2Service.type,\n NewDidCommV2Service.type,\n ]\n const services = (this.service?.filter((service) => didCommServiceTypes.includes(service.type)) ?? []) as Array<\n IndyAgentService | DidCommV1Service | DidCommV2Service | NewDidCommV2Service\n >\n\n // Sort services based on indicated priority. DIDComm V2 services do not\n // carry a priority field; treat them as priority 0 for a stable ordering.\n const getPriority = (\n service: IndyAgentService | DidCommV1Service | DidCommV2Service | NewDidCommV2Service\n ): number => (service instanceof IndyAgentService || service instanceof DidCommV1Service ? service.priority : 0)\n\n return services.sort((a, b) => getPriority(a) - getPriority(b))\n }\n\n // TODO: it would probably be easier if we add a utility to each service so we don't have to handle logic for all service types here\n public get recipientKeys(): PublicJwk<Ed25519PublicJwk | X25519PublicJwk | P256PublicJwk | P384PublicJwk>[] {\n return this.getRecipientKeysWithVerificationMethod({\n // False for now to avoid breaking changes\n mapX25519ToEd25519: false,\n }).map(({ publicJwk }) => publicJwk)\n }\n\n /**\n * Returns the recipient keys with their verification method matches\n *\n * We should probably deprecate recipientKeys in favour of this one\n */\n public getRecipientKeysWithVerificationMethod<MapX25519ToEd25519 extends boolean>({\n mapX25519ToEd25519,\n }: {\n mapX25519ToEd25519: MapX25519ToEd25519\n }): Array<{\n verificationMethod: VerificationMethod\n publicJwk: PublicJwk<\n | (MapX25519ToEd25519 extends true ? Ed25519PublicJwk : Ed25519PublicJwk | X25519PublicJwk)\n | P256PublicJwk\n | P384PublicJwk\n >\n }> {\n const recipientKeys: Array<{\n verificationMethod: VerificationMethod\n publicJwk: PublicJwk<Ed25519PublicJwk | X25519PublicJwk | P256PublicJwk | P384PublicJwk>\n }> = []\n\n const seenVerificationMethodIds: string[] = []\n for (const service of this.didCommServices) {\n if (service instanceof IndyAgentService) {\n for (const publicKeyBase58 of service.recipientKeys) {\n const publicJwk = PublicJwk.fromPublicKey({\n kty: 'OKP',\n crv: 'Ed25519',\n publicKey: TypedArrayEncoder.fromBase58(publicKeyBase58),\n })\n const verificationMethod = [...(this.verificationMethod ?? []), ...(this.authentication ?? [])]\n .map((v) => (typeof v === 'string' ? this.dereferenceVerificationMethod(v) : v))\n .find((v) => {\n const vPublicJwk = getPublicJwkFromVerificationMethod(v)\n return vPublicJwk.equals(publicJwk)\n })\n\n if (!verificationMethod) {\n throw new CredoError('Could not find verification method for IndyAgentService recipient key')\n }\n\n // Skip adding if already present\n if (seenVerificationMethodIds.includes(verificationMethod.id)) {\n continue\n }\n\n recipientKeys.push({\n publicJwk,\n verificationMethod,\n })\n seenVerificationMethodIds.push(verificationMethod.id)\n }\n } else if (service instanceof DidCommV1Service) {\n for (const recipientKey of service.recipientKeys) {\n const verificationMethod = this.dereferenceKey(recipientKey, ['authentication', 'keyAgreement'])\n if (seenVerificationMethodIds.includes(verificationMethod.id)) {\n // Skip adding if already present\n continue\n }\n\n const publicJwk = getPublicJwkFromVerificationMethod(verificationMethod)\n\n if (!publicJwk.is(Ed25519PublicJwk, X25519PublicJwk)) {\n throw new CredoError(\n 'Expected either Ed25519PublicJwk or X25519PublicJwk for DidcommV1Service recipient key'\n )\n }\n\n recipientKeys.push({\n publicJwk,\n verificationMethod,\n })\n seenVerificationMethodIds.push(verificationMethod.id)\n }\n } else if (service instanceof DidCommV2Service || service instanceof NewDidCommV2Service) {\n // DidCommV2Service: keys come from DID document keyAgreement\n for (const keyRef of this.keyAgreement ?? []) {\n const verificationMethod = typeof keyRef === 'string' ? this.dereferenceVerificationMethod(keyRef) : keyRef\n if (seenVerificationMethodIds.includes(verificationMethod.id)) {\n continue\n }\n\n const publicJwk = getPublicJwkFromVerificationMethod(verificationMethod)\n if (!publicJwk.is(Ed25519PublicJwk, X25519PublicJwk, P256PublicJwk, P384PublicJwk)) {\n continue\n }\n\n recipientKeys.push({\n publicJwk,\n verificationMethod,\n })\n seenVerificationMethodIds.push(verificationMethod.id)\n }\n }\n }\n\n if (!mapX25519ToEd25519) {\n return recipientKeys as Array<{\n verificationMethod: VerificationMethod\n publicJwk: PublicJwk<\n | (MapX25519ToEd25519 extends true ? Ed25519PublicJwk : Ed25519PublicJwk | X25519PublicJwk)\n | P256PublicJwk\n | P384PublicJwk\n >\n }>\n }\n\n return recipientKeys.flatMap(({ publicJwk, verificationMethod }) => {\n if (publicJwk.is(Ed25519PublicJwk, P256PublicJwk, P384PublicJwk)) return [{ publicJwk, verificationMethod }]\n\n const matchingEd25519Key = findMatchingEd25519Key(publicJwk as PublicJwk<X25519PublicJwk>, this)\n\n // For DIDcomm v1 if you use X25519 you MUST also include the Ed25519 key\n if (!matchingEd25519Key) {\n throw new CredoError(\n `Unable to find matching Ed25519 key for X25519 verification method with id ${verificationMethod.id}`\n )\n }\n\n return [matchingEd25519Key]\n })\n }\n\n public toJSON() {\n return JsonTransformer.toJSON(this)\n }\n\n public static fromJSON(didDocument: unknown) {\n return JsonTransformer.fromJSON(didDocument, DidDocument)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,IAAa,cAAb,MAAa,YAAY;CA0DvB,YAAmB,SAA6B;EAzDhD,KAEO,UAA6B,CAAC,8BAA8B;EAwDjE,IAAI,SAAS;GACX,KAAK,UAAU,QAAQ,WAAW,KAAK;GACvC,KAAK,KAAK,QAAQ;GAClB,KAAK,cAAc,QAAQ;GAC3B,KAAK,aAAa,QAAQ;GAC1B,KAAK,qBAAqB,QAAQ;GAClC,KAAK,UAAU,QAAQ;GACvB,KAAK,iBAAiB,QAAQ;GAC9B,KAAK,kBAAkB,QAAQ;GAC/B,KAAK,eAAe,QAAQ;GAC5B,KAAK,uBAAuB,QAAQ;GACpC,KAAK,uBAAuB,QAAQ;EACtC;CACF;CAEA,8BAAqC,OAAe;EAIlD,MAAM,qBAAqB,KAAK,oBAAoB,MAAM,QAAQ,KAAK,WAAW,OAAO,IAAI,EAAE,CAAC;EAEhG,IAAI,CAAC,oBACH,MAAM,IAAI,WAAW,iDAAiD,MAAM,EAAE;EAGhF,OAAO;CACT;CAEA,eAAsB,OAAe,iBAA4C;EAU/E,MAAM,WAAW,mBAAmB;GARlC;GACA;GACA;GACA;GACA;GACA;EAG4C;EAE9C,KAAK,MAAM,WAAW,UACpB,KAAK,MAAM,OAAO,KAAK,YAAY,CAAC,GAAG;GACrC,IAAI,OAAO,QAAQ,YAAY,KAAK,WAAW,OAAO,GAAG,GACvD,OA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CAC1D;AACF;;CAhWG,OAAO,EAAE,MAAM,WAAW,CAAC;CAC3B,sBAAsB;;;AAGtB,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,YAAA,WAAA,MAAA,KAAA,CAAA;;CAGT,QAAQ;CACR,SAAS,EAAE,MAAM,KAAK,CAAC;CACvB,WAAW;;;;CAGX,sBAAsB;CACtB,WAAW;;;;CAGX,QAAQ;CACR,eAAe,EAAE,MAAM,KAAK,CAAC;CAC7B,WAAW,kBAAkB;CAC7B,WAAW;;;;CAGX,QAAQ;CACR,mBAAmB;CACnB,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW"}
|
|
1
|
+
{"version":3,"file":"DidDocument.mjs","names":[],"sources":["../../../../src/modules/dids/domain/DidDocument.ts"],"sourcesContent":["import { Expose, Type } from 'class-transformer'\nimport { IsArray, IsOptional, IsString, ValidateNested } from 'class-validator'\nimport { CredoError } from '../../../error'\nimport { TypedArrayEncoder } from '../../../utils'\nimport { JsonTransformer } from '../../../utils/JsonTransformer'\nimport { IsStringOrStringArray } from '../../../utils/transformers'\nimport { Ed25519PublicJwk, PublicJwk, X25519PublicJwk } from '../../kms'\nimport { findMatchingEd25519Key } from '../findMatchingEd25519Key'\nimport { getPublicJwkFromVerificationMethod } from './key-type'\nimport type { DidDocumentService } from './service'\nimport { DidCommV1Service, IndyAgentService } from './service'\nimport { ServiceTransformer } from './service/ServiceTransformer'\nimport { IsStringOrVerificationMethod, VerificationMethod, VerificationMethodTransformer } from './verificationMethod'\n\nexport type DidPurpose =\n | 'authentication'\n | 'keyAgreement'\n | 'assertionMethod'\n | 'capabilityInvocation'\n | 'capabilityDelegation'\n\ntype DidVerificationMethods = DidPurpose | 'verificationMethod'\n\ninterface DidDocumentOptions {\n context?: string | string[]\n id: string\n alsoKnownAs?: string[]\n controller?: string | string[]\n verificationMethod?: VerificationMethod[]\n service?: DidDocumentService[]\n authentication?: Array<string | VerificationMethod>\n assertionMethod?: Array<string | VerificationMethod>\n keyAgreement?: Array<string | VerificationMethod>\n capabilityInvocation?: Array<string | VerificationMethod>\n capabilityDelegation?: Array<string | VerificationMethod>\n}\n\nexport class DidDocument {\n @Expose({ name: '@context' })\n @IsStringOrStringArray()\n public context: string | string[] = ['https://www.w3.org/ns/did/v1']\n\n @IsString()\n public id!: string\n\n @IsArray()\n @IsString({ each: true })\n @IsOptional()\n public alsoKnownAs?: string[]\n\n @IsStringOrStringArray()\n @IsOptional()\n public controller?: string | string[]\n\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => VerificationMethod)\n @IsOptional()\n public verificationMethod?: VerificationMethod[]\n\n @IsArray()\n @ServiceTransformer()\n @IsOptional()\n public service?: DidDocumentService[]\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public authentication?: Array<string | VerificationMethod>\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public assertionMethod?: Array<string | VerificationMethod>\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public keyAgreement?: Array<string | VerificationMethod>\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public capabilityInvocation?: Array<string | VerificationMethod>\n\n @IsArray()\n @VerificationMethodTransformer()\n @IsStringOrVerificationMethod({ each: true })\n @IsOptional()\n public capabilityDelegation?: Array<string | VerificationMethod>\n\n public constructor(options: DidDocumentOptions) {\n if (options) {\n this.context = options.context ?? this.context\n this.id = options.id\n this.alsoKnownAs = options.alsoKnownAs\n this.controller = options.controller\n this.verificationMethod = options.verificationMethod\n this.service = options.service\n this.authentication = options.authentication\n this.assertionMethod = options.assertionMethod\n this.keyAgreement = options.keyAgreement\n this.capabilityInvocation = options.capabilityInvocation\n this.capabilityDelegation = options.capabilityDelegation\n }\n }\n\n public dereferenceVerificationMethod(keyId: string) {\n // TODO: once we use JSON-LD we should use that to resolve references in did documents.\n // for now we check whether the key id ends with the keyId.\n // so if looking for #123 and key.id is did:key:123#123, it is valid. But #123 as key.id is also valid\n const verificationMethod = this.verificationMethod?.find((key) => this.matchKeyId(keyId, key.id))\n\n if (!verificationMethod) {\n throw new CredoError(`Unable to locate verification method with id '${keyId}'`)\n }\n\n return verificationMethod\n }\n\n public dereferenceKey(keyId: string, allowedPurposes?: DidVerificationMethods[]) {\n const allPurposes: DidVerificationMethods[] = [\n 'authentication',\n 'keyAgreement',\n 'assertionMethod',\n 'capabilityInvocation',\n 'capabilityDelegation',\n 'verificationMethod',\n ]\n\n const purposes = allowedPurposes ?? allPurposes\n\n for (const purpose of purposes) {\n for (const key of this[purpose] ?? []) {\n if (typeof key === 'string' && this.matchKeyId(keyId, key)) {\n return this.dereferenceVerificationMethod(key)\n }\n if (typeof key !== 'string' && this.matchKeyId(keyId, key.id)) {\n return key\n }\n }\n }\n\n throw new CredoError(`Unable to locate verification method with id '${keyId}' in purposes ${purposes}`)\n }\n\n public findVerificationMethodsByPurpose(allowedPurposes: readonly DidVerificationMethods[]): VerificationMethod[] {\n const methods: VerificationMethod[] = []\n\n for (const purpose of allowedPurposes) {\n for (const entry of this[purpose] ?? []) {\n methods.push(typeof entry === 'string' ? this.dereferenceVerificationMethod(entry) : entry)\n }\n }\n\n return methods\n }\n\n public findVerificationMethodsByTypeAndPurpose(\n verificationMethodTypes: string | readonly string[],\n allowedPurposes: readonly DidVerificationMethods[]\n ): VerificationMethod[] {\n const acceptedTypes = new Set(\n typeof verificationMethodTypes === 'string' ? [verificationMethodTypes] : verificationMethodTypes\n )\n\n return this.findVerificationMethodsByPurpose(allowedPurposes).filter((method) => acceptedTypes.has(method.type))\n }\n\n private matchKeyId(externalKeyId: string, didDocumentKeyId: string) {\n // Compact is did removed from start but only if it matches the id of this document.\n const compactExternalKeyId = externalKeyId.startsWith(this.id) ? externalKeyId.slice(this.id.length) : externalKeyId\n const compactDidDocumentKeyId = didDocumentKeyId.startsWith(this.id)\n ? didDocumentKeyId.slice(this.id.length)\n : didDocumentKeyId\n\n return compactExternalKeyId === compactDidDocumentKeyId\n }\n\n public findVerificationMethodByPublicKey(publicJwk: PublicJwk, allowedPurposes?: DidVerificationMethods[]) {\n const allPurposes: DidVerificationMethods[] = [\n 'authentication',\n 'keyAgreement',\n 'assertionMethod',\n 'capabilityInvocation',\n 'capabilityDelegation',\n 'verificationMethod',\n ]\n\n const purposes = allowedPurposes ?? allPurposes\n\n for (const purpose of purposes) {\n for (const key of this[purpose] ?? []) {\n const verificationMethod = typeof key === 'string' ? this.dereferenceVerificationMethod(key) : key\n if (getPublicJwkFromVerificationMethod(verificationMethod).equals(publicJwk)) return verificationMethod\n }\n }\n\n throw new CredoError(\n `Unable to locate verification method with public key ${publicJwk.jwkTypeHumanDescription} in purposes ${purposes}`\n )\n }\n\n /**\n * Returns all of the service endpoints matching the given type.\n *\n * @param type The type of service(s) to query.\n */\n public getServicesByType<S extends DidDocumentService = DidDocumentService>(type: string): S[] {\n return (this.service?.filter((service) => service.type === type) ?? []) as S[]\n }\n\n /**\n * Returns all of the service endpoints matching the given class\n *\n * @param classType The class to query services.\n */\n public getServicesByClassType<S extends DidDocumentService = DidDocumentService>(\n classType: new (...args: never[]) => S\n ): S[] {\n return (this.service?.filter((service) => service instanceof classType) ?? []) as S[]\n }\n\n /**\n * Get all DIDComm services ordered by priority descending. This means the highest\n * priority will be the first entry.\n */\n public get didCommServices(): Array<IndyAgentService | DidCommV1Service> {\n const didCommServiceTypes = [IndyAgentService.type, DidCommV1Service.type]\n const services = (this.service?.filter((service) => didCommServiceTypes.includes(service.type)) ?? []) as Array<\n IndyAgentService | DidCommV1Service\n >\n\n // Sort services based on indicated priority\n return services.sort((a, b) => a.priority - b.priority)\n }\n\n // TODO: it would probably be easier if we add a utility to each service so we don't have to handle logic for all service types here\n public get recipientKeys(): PublicJwk<Ed25519PublicJwk | X25519PublicJwk>[] {\n return this.getRecipientKeysWithVerificationMethod({\n // False for now to avoid breaking changes\n mapX25519ToEd25519: false,\n }).map(({ publicJwk }) => publicJwk)\n }\n\n /**\n * Returns the recipient keys with their verification method matches\n *\n * We should probably deprecate recipientKeys in favour of this one\n */\n public getRecipientKeysWithVerificationMethod<MapX25519ToEd25519 extends boolean>({\n mapX25519ToEd25519,\n }: {\n mapX25519ToEd25519: MapX25519ToEd25519\n }): Array<{\n verificationMethod: VerificationMethod\n publicJwk: PublicJwk<MapX25519ToEd25519 extends true ? Ed25519PublicJwk : Ed25519PublicJwk | X25519PublicJwk>\n }> {\n const recipientKeys: Array<{\n verificationMethod: VerificationMethod\n publicJwk: PublicJwk<Ed25519PublicJwk | X25519PublicJwk>\n }> = []\n\n const seenVerificationMethodIds: string[] = []\n for (const service of this.didCommServices) {\n if (service.type === IndyAgentService.type) {\n for (const publicKeyBase58 of service.recipientKeys) {\n const publicJwk = PublicJwk.fromPublicKey({\n kty: 'OKP',\n crv: 'Ed25519',\n publicKey: TypedArrayEncoder.fromBase58(publicKeyBase58),\n })\n const verificationMethod = [...(this.verificationMethod ?? []), ...(this.authentication ?? [])]\n .map((v) => (typeof v === 'string' ? this.dereferenceVerificationMethod(v) : v))\n .find((v) => {\n const vPublicJwk = getPublicJwkFromVerificationMethod(v)\n return vPublicJwk.equals(publicJwk)\n })\n\n if (!verificationMethod) {\n throw new CredoError('Could not find verification method for IndyAgentService recipient key')\n }\n\n // Skip adding if already present\n if (seenVerificationMethodIds.includes(verificationMethod.id)) {\n continue\n }\n\n recipientKeys.push({\n publicJwk,\n verificationMethod,\n })\n }\n } else if (service.type === DidCommV1Service.type) {\n for (const recipientKey of service.recipientKeys) {\n const verificationMethod = this.dereferenceKey(recipientKey, ['authentication', 'keyAgreement'])\n if (seenVerificationMethodIds.includes(verificationMethod.id)) {\n // Skip adding if already present\n continue\n }\n\n const publicJwk = getPublicJwkFromVerificationMethod(verificationMethod)\n\n if (!publicJwk.is(Ed25519PublicJwk, X25519PublicJwk)) {\n throw new CredoError(\n 'Expected either Ed25519PublicJwk or X25519PublicJwk for DidcommV1Service recipient key'\n )\n }\n\n recipientKeys.push({\n publicJwk,\n verificationMethod,\n })\n }\n }\n }\n\n if (!mapX25519ToEd25519) {\n return recipientKeys as Array<{\n verificationMethod: VerificationMethod\n publicJwk: PublicJwk<MapX25519ToEd25519 extends true ? Ed25519PublicJwk : Ed25519PublicJwk | X25519PublicJwk>\n }>\n }\n\n return recipientKeys.map(({ publicJwk, verificationMethod }) => {\n if (publicJwk.is(Ed25519PublicJwk)) return { publicJwk, verificationMethod }\n\n const matchingEd25519Key = findMatchingEd25519Key(publicJwk as PublicJwk<X25519PublicJwk>, this)\n\n // For DIDcomm v1 if you use X25519 you MUST also include the Ed25519 key\n if (!matchingEd25519Key) {\n throw new CredoError(\n `Unable to find matching Ed25519 key for X25519 verification method with id ${verificationMethod.id}`\n )\n }\n\n return matchingEd25519Key\n })\n }\n\n public toJSON() {\n return JsonTransformer.toJSON(this)\n }\n\n public static fromJSON(didDocument: unknown) {\n return JsonTransformer.fromJSON(didDocument, DidDocument)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,IAAa,cAAb,MAAa,YAAY;CA0DvB,YAAmB,SAA6B;EAzDhD,KAEO,UAA6B,CAAC,8BAA8B;EAwDjE,IAAI,SAAS;GACX,KAAK,UAAU,QAAQ,WAAW,KAAK;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;EACd,OAAO,gBAAgB,OAAO,IAAI;CACpC;CAEA,OAAc,SAAS,aAAsB;EAC3C,OAAO,gBAAgB,SAAS,aAAa,WAAW;CAC1D;AACF;;CAzTG,OAAO,EAAE,MAAM,WAAW,CAAC;CAC3B,sBAAsB;;;AAGtB,WAAA,CAAA,SAAS,GAAA,mBAAA,eAAA,MAAA,CAAA,GAAA,YAAA,WAAA,MAAA,KAAA,CAAA;;CAGT,QAAQ;CACR,SAAS,EAAE,MAAM,KAAK,CAAC;CACvB,WAAW;;;;CAGX,sBAAsB;CACtB,WAAW;;;;CAGX,QAAQ;CACR,eAAe,EAAE,MAAM,KAAK,CAAC;CAC7B,WAAW,kBAAkB;CAC7B,WAAW;;;;CAGX,QAAQ;CACR,mBAAmB;CACnB,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW;;;;CAGX,QAAQ;CACR,8BAA8B;CAC9B,6BAA6B,EAAE,MAAM,KAAK,CAAC;CAC3C,WAAW"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DidDocument } from "../../domain/DidDocument.mjs";
|
|
2
2
|
import "../../domain/index.mjs";
|
|
3
3
|
//#region src/modules/dids/methods/peer/peerDidNumAlgo2.d.ts
|
|
4
|
-
export declare function didToNumAlgo2DidDocument(did: string): DidDocument;
|
|
5
4
|
export declare function didDocumentToNumAlgo2Did(didDocument: DidDocument): string;
|
|
6
5
|
//#endregion
|
|
7
6
|
//# sourceMappingURL=peerDidNumAlgo2.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peerDidNumAlgo2.d.mts","names":[],"sources":["../../../../../src/modules/dids/methods/peer/peerDidNumAlgo2.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"peerDidNumAlgo2.d.mts","names":[],"sources":["../../../../../src/modules/dids/methods/peer/peerDidNumAlgo2.ts"],"mappings":";;;wBA2FgB,yBAAyB,aAAa"}
|
|
@@ -8,9 +8,6 @@ import "../../../kms/index.mjs";
|
|
|
8
8
|
import { parseDid } from "../../domain/parse.mjs";
|
|
9
9
|
import { getPublicJwkFromVerificationMethod, getVerificationMethodsForPublicJwk } from "../../domain/key-type/keyDidMapping.mjs";
|
|
10
10
|
import { DidDocumentService } from "../../domain/service/DidDocumentService.mjs";
|
|
11
|
-
import { DidCommV2Service } from "../../domain/service/DidCommV2Service.mjs";
|
|
12
|
-
import { LegacyDidCommV2Service } from "../../domain/service/LegacyDidCommV2Service.mjs";
|
|
13
|
-
import { serviceTypes } from "../../domain/service/ServiceTransformer.mjs";
|
|
14
11
|
import { DidDocumentBuilder } from "../../domain/DidDocumentBuilder.mjs";
|
|
15
12
|
import "../../domain/index.mjs";
|
|
16
13
|
//#region src/modules/dids/methods/peer/peerDidNumAlgo2.ts
|
|
@@ -54,9 +51,7 @@ function didToNumAlgo2DidDocument(did) {
|
|
|
54
51
|
for (let service of services) {
|
|
55
52
|
service = expandServiceAbbreviations(service);
|
|
56
53
|
service.id = `${did}#${service.type.toLowerCase()}-${serviceIndex++}`;
|
|
57
|
-
|
|
58
|
-
if (service.type === DidCommV2Service.type && "serviceEndpoint" in service && typeof service.serviceEndpoint === "string") serviceClass = LegacyDidCommV2Service;
|
|
59
|
-
didDocument.addService(JsonTransformer.fromJSON(service, serviceClass));
|
|
54
|
+
didDocument.addService(JsonTransformer.fromJSON(service, DidDocumentService));
|
|
60
55
|
}
|
|
61
56
|
} else {
|
|
62
57
|
const publicJwk = PublicJwk.fromFingerprint(entryContent);
|