UNPKG

@sphereon/ssi-sdk-ext.identifier-resolution

Version:

1,285 lines (1,283 loc) 425 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // plugin.schema.json var require_plugin_schema = __commonJS({ "plugin.schema.json"(exports, module2) { module2.exports = { IIdentifierResolution: { components: { schemas: { ExternalIdentifierOpts: { anyOf: [ { type: "object", properties: { method: { type: "string", const: "jwk" }, identifier: { $ref: "#/components/schemas/ExternalIdentifierType" }, x5c: { $ref: "#/components/schemas/ExternalIdentifierX5cOpts" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "x5c" }, identifier: { $ref: "#/components/schemas/ExternalIdentifierType" }, verify: { type: "boolean" }, verificationTime: { type: "string", format: "date-time" }, trustAnchors: { type: "array", items: { type: "string" } }, allowNoTrustAnchorsFound: { type: "boolean" }, trustRootWhenNoAnchors: { type: "boolean" }, allowSingleNoCAChainElement: { type: "boolean" }, blindlyTrustedAnchors: { type: "array", items: { type: "string" } }, disallowReversedChain: { type: "boolean" }, client: { type: "object", properties: { clientId: { type: "string" }, clientIdScheme: { type: "string", enum: [ "x509_san_dns", "x509_san_uri" ] } }, required: [ "clientId", "clientIdScheme" ] } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "did" }, identifier: { $ref: "#/components/schemas/ExternalIdentifierType" }, noVerificationMethodFallback: { type: "boolean" }, vmRelationship: { $ref: "#/components/schemas/DIDDocumentSection" }, localResolution: { type: "boolean" }, uniresolverResolution: { type: "boolean" }, resolverResolution: { type: "boolean" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "kid" }, identifier: { $ref: "#/components/schemas/ExternalIdentifierType" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "cose_key" }, identifier: { $ref: "#/components/schemas/ExternalIdentifierType" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "entity_id" }, identifier: { $ref: "#/components/schemas/ExternalIdentifierType" }, trustAnchors: { type: "array", items: { type: "string" } } }, required: [ "identifier" ] } ] }, ExternalIdentifierType: { anyOf: [ { type: "string" }, { type: "array", items: { type: "string" } }, { type: "object", properties: { kty: { type: "string", enum: [ "EC", "RSA", "oct", "OKP" ] }, crv: { type: "string", enum: [ "P-256", "P-384", "P-521", "X25519", "X448", "EdDSA", "Ed25519", "Ed448", "secp256k1" ] }, alg: { type: "string", enum: [ "RS256", "RS384", "RS512", "ES256", "ES256K", "ES384", "ES512", "EdDSA", "HS256", "HS384", "HS512", "PS256", "PS384", "PS512", "none" ] }, x: { type: "string" }, y: { type: "string" }, e: { type: "string" }, n: { type: "string" }, d: { type: "string" }, dp: { type: "string" }, dq: { type: "string" }, ext: { type: "boolean" }, k: { type: "string" }, key_ops: { type: "array", items: { type: "string", enum: [ "sign", "verify", "encrypt", "decrypt", "wrapKey", "unwrapKey", "deriveKey", "deriveBits" ] } }, kid: { type: "string" }, oth: { type: "array", items: { type: "object", properties: { d: { type: "string" }, r: { type: "string" }, t: { type: "string" } } } }, p: { type: "string" }, q: { type: "string" }, qi: { type: "string" }, use: { type: "string" }, x5c: { type: "array", items: { type: "string" }, description: 'JWK "x5c" (X.509 Certificate Chain) Parameter.' }, x5t: { type: "string", description: 'JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter.' }, "x5t#S256": { type: "string", description: '"x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter.' }, x5u: { type: "string", description: 'JWK "x5u" (X.509 URL) Parameter.' }, iv: { type: "string" } }, additionalProperties: {}, required: [ "kty" ] } ], description: "Use whenever we need to resolve an external identifier. We can pass in kids, DIDs, and x5chains\n\nThe functions below can be used to check the type, and they also provide the proper runtime types" }, ExternalIdentifierX5cOpts: { type: "object", properties: { method: { type: "string", const: "x5c" }, identifier: { $ref: "#/components/schemas/ExternalIdentifierType" }, verify: { type: "boolean" }, verificationTime: { type: "string", format: "date-time" }, trustAnchors: { type: "array", items: { type: "string" } }, allowNoTrustAnchorsFound: { type: "boolean" }, trustRootWhenNoAnchors: { type: "boolean" }, allowSingleNoCAChainElement: { type: "boolean" }, blindlyTrustedAnchors: { type: "array", items: { type: "string" } }, disallowReversedChain: { type: "boolean" }, client: { type: "object", properties: { clientId: { type: "string" }, clientIdScheme: { type: "string", enum: [ "x509_san_dns", "x509_san_uri" ] } }, required: [ "clientId", "clientIdScheme" ] } }, required: [ "identifier" ] }, DIDDocumentSection: { type: "string", enum: [ "verificationMethod", "publicKey", "service", "authentication", "assertionMethod", "keyAgreement", "capabilityInvocation", "capabilityDelegation" ], description: "Refers to a section of a DID document. Either the list of verification methods or services or one of the verification relationships.\n\nSee {@link https://www.w3.org/TR/did-core/#verification-relationships | verification relationships }" }, ExternalIdentifierResult: { anyOf: [ { type: "object", properties: { method: { $ref: "#/components/schemas/ExternalIdentifierMethod" }, jwks: { type: "array", items: { $ref: "#/components/schemas/ExternalJwkInfo" } }, did: { type: "string" }, didDocument: { $ref: "#/components/schemas/DIDDocument" }, didJwks: { type: "object", properties: { verificationMethod: { type: "array", items: { type: "object", properties: { kty: { type: "string", enum: [ "EC", "RSA", "oct", "OKP" ] }, crv: { type: "string", enum: [ "P-256", "P-384", "P-521", "X25519", "X448", "EdDSA", "Ed25519", "Ed448", "secp256k1" ] }, alg: { type: "string", enum: [ "RS256", "RS384", "RS512", "ES256", "ES256K", "ES384", "ES512", "EdDSA", "HS256", "HS384", "HS512", "PS256", "PS384", "PS512", "none" ] }, x: { type: "string" }, y: { type: "string" }, e: { type: "string" }, n: { type: "string" }, d: { type: "string" }, dp: { type: "string" }, dq: { type: "string" }, ext: { type: "boolean" }, k: { type: "string" }, key_ops: { type: "array", items: { type: "string", enum: [ "sign", "verify", "encrypt", "decrypt", "wrapKey", "unwrapKey", "deriveKey", "deriveBits" ] } }, kid: { type: "string" }, oth: { type: "array", items: { type: "object", properties: { d: { type: "string" }, r: { type: "string" }, t: { type: "string" } } } }, p: { type: "string" }, q: { type: "string" }, qi: { type: "string" }, use: { type: "string" }, x5c: { type: "array", items: { type: "string" }, description: 'JWK "x5c" (X.509 Certificate Chain) Parameter.' }, x5t: { type: "string", description: 'JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter.' }, "x5t#S256": { type: "string", description: '"x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter.' }, x5u: { type: "string", description: 'JWK "x5u" (X.509 URL) Parameter.' }, iv: { type: "string" } }, additionalProperties: {}, required: [ "kty" ] } }, authentication: { type: "array", items: { type: "object", properties: { kty: { type: "string", enum: [ "EC", "RSA", "oct", "OKP" ] }, crv: { type: "string", enum: [ "P-256", "P-384", "P-521", "X25519", "X448", "EdDSA", "Ed25519", "Ed448", "secp256k1" ] }, alg: { type: "string", enum: [ "RS256", "RS384", "RS512", "ES256", "ES256K", "ES384", "ES512", "EdDSA", "HS256", "HS384", "HS512", "PS256", "PS384", "PS512", "none" ] }, x: { type: "string" }, y: { type: "string" }, e: { type: "string" }, n: { type: "string" }, d: { type: "string" }, dp: { type: "string" }, dq: { type: "string" }, ext: { type: "boolean" }, k: { type: "string" }, key_ops: { type: "array", items: { type: "string", enum: [ "sign", "verify", "encrypt", "decrypt", "wrapKey", "unwrapKey", "deriveKey", "deriveBits" ] } }, kid: { type: "string" }, oth: { type: "array", items: { type: "object", properties: { d: { type: "string" }, r: { type: "string" }, t: { type: "string" } } } }, p: { type: "string" }, q: { type: "string" }, qi: { type: "string" }, use: { type: "string" }, x5c: { type: "array", items: { type: "string" }, description: 'JWK "x5c" (X.509 Certificate Chain) Parameter.' }, x5t: { type: "string", description: 'JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter.' }, "x5t#S256": { type: "string", description: '"x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter.' }, x5u: { type: "string", description: 'JWK "x5u" (X.509 URL) Parameter.' }, iv: { type: "string" } }, additionalProperties: {}, required: [ "kty" ] } }, assertionMethod: { type: "array", items: { type: "object", properties: { kty: { type: "string", enum: [ "EC", "RSA", "oct", "OKP" ] }, crv: { type: "string", enum: [ "P-256", "P-384", "P-521", "X25519", "X448", "EdDSA", "Ed25519", "Ed448", "secp256k1" ] }, alg: { type: "string", enum: [ "RS256", "RS384", "RS512", "ES256", "ES256K", "ES384", "ES512", "EdDSA", "HS256", "HS384", "HS512", "PS256", "PS384", "PS512", "none" ] }, x: { type: "string" }, y: { type: "string" }, e: { type: "string" }, n: { type: "string" }, d: { type: "string" }, dp: { type: "string" }, dq: { type: "string" }, ext: { type: "boolean" }, k: { type: "string" }, key_ops: { type: "array", items: { type: "string", enum: [ "sign", "verify", "encrypt", "decrypt", "wrapKey", "unwrapKey", "deriveKey", "deriveBits" ] } }, kid: { type: "string" }, oth: { type: "array", items: { type: "object", properties: { d: { type: "string" }, r: { type: "string" }, t: { type: "string" } } } }, p: { type: "string" }, q: { type: "string" }, qi: { type: "string" }, use: { type: "string" }, x5c: { type: "array", items: { type: "string" }, description: 'JWK "x5c" (X.509 Certificate Chain) Parameter.' }, x5t: { type: "string", description: 'JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter.' }, "x5t#S256": { type: "string", description: '"x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter.' }, x5u: { type: "string", description: 'JWK "x5u" (X.509 URL) Parameter.' }, iv: { type: "string" } }, additionalProperties: {}, required: [ "kty" ] } }, keyAgreement: { type: "array", items: { type: "object", properties: { kty: { type: "string", enum: [ "EC", "RSA", "oct", "OKP" ] }, crv: { type: "string", enum: [ "P-256", "P-384", "P-521", "X25519", "X448", "EdDSA", "Ed25519", "Ed448", "secp256k1" ] }, alg: { type: "string", enum: [ "RS256", "RS384", "RS512", "ES256", "ES256K", "ES384", "ES512", "EdDSA", "HS256", "HS384", "HS512", "PS256", "PS384", "PS512", "none" ] }, x: { type: "string" }, y: { type: "string" }, e: { type: "string" }, n: { type: "string" }, d: { type: "string" }, dp: { type: "string" }, dq: { type: "string" }, ext: { type: "boolean" }, k: { type: "string" }, key_ops: { type: "array", items: { type: "string", enum: [ "sign", "verify", "encrypt", "decrypt", "wrapKey", "unwrapKey", "deriveKey", "deriveBits" ] } }, kid: { type: "string" }, oth: { type: "array", items: { type: "object", properties: { d: { type: "string" }, r: { type: "string" }, t: { type: "string" } } } }, p: { type: "string" }, q: { type: "string" }, qi: { type: "string" }, use: { type: "string" }, x5c: { type: "array", items: { type: "string" }, description: 'JWK "x5c" (X.509 Certificate Chain) Parameter.' }, x5t: { type: "string", description: 'JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter.' }, "x5t#S256": { type: "string", description: '"x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter.' }, x5u: { type: "string", description: 'JWK "x5u" (X.509 URL) Parameter.' }, iv: { type: "string" } }, additionalProperties: {}, required: [ "kty" ] } }, capabilityInvocation: { type: "array", items: { type: "object", properties: { kty: { type: "string", enum: [ "EC", "RSA", "oct", "OKP" ] }, crv: { type: "string", enum: [ "P-256", "P-384", "P-521", "X25519", "X448", "EdDSA", "Ed25519", "Ed448", "secp256k1" ] }, alg: { type: "string", enum: [ "RS256", "RS384", "RS512", "ES256", "ES256K", "ES384", "ES512", "EdDSA", "HS256", "HS384", "HS512", "PS256", "PS384", "PS512", "none" ] }, x: { type: "string" }, y: { type: "string" }, e: { type: "string" }, n: { type: "string" }, d: { type: "string" }, dp: { type: "string" }, dq: { type: "string" }, ext: { type: "boolean" }, k: { type: "string" }, key_ops: { type: "array", items: { type: "string", enum: [ "sign", "verify", "encrypt", "decrypt", "wrapKey", "unwrapKey", "deriveKey", "deriveBits" ] } }, kid: { type: "string" }, oth: { type: "array", items: { type: "object", properties: { d: { type: "string" }, r: { type: "string" }, t: { type: "string" } } } }, p: { type: "string" }, q: { type: "string" }, qi: { type: "string" }, use: { type: "string" }, x5c: { type: "array", items: { type: "string" }, description: 'JWK "x5c" (X.509 Certificate Chain) Parameter.' }, x5t: { type: "string", description: 'JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter.' }, "x5t#S256": { type: "string", description: '"x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter.' }, x5u: { type: "string", description: 'JWK "x5u" (X.509 URL) Parameter.' }, iv: { type: "string" } }, additionalProperties: {}, required: [ "kty" ] } }, capabilityDelegation: { type: "array", items: { type: "object", properties: { kty: { type: "string", enum: [ "EC", "RSA", "oct", "OKP" ] }, crv: { type: "string", enum: [ "P-256", "P-384", "P-521", "X25519", "X448", "EdDSA", "Ed25519", "Ed448", "secp256k1" ] }, alg: { type: "string", enum: [ "RS256", "RS384", "RS512", "ES256", "ES256K", "ES384", "ES512", "EdDSA", "HS256", "HS384", "HS512", "PS256", "PS384", "PS512", "none" ] }, x: { type: "string" },