UNPKG

@sphereon/ssi-sdk-ext.jwt-service

Version:

1,170 lines (1,168 loc) 1.62 MB
"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 = { IJwtService: { components: { schemas: { CreateJwsCompactArgs: { $ref: "#/components/schemas/CreateJwsArgs" }, CreateJwsArgs: { type: "object", properties: { mode: { $ref: "#/components/schemas/JwsIdentifierMode" }, issuer: { anyOf: [ { type: "object", properties: { noIssPayloadUpdate: { type: "boolean" }, noIdentifierInHeader: { type: "boolean" }, lazyDisabled: { type: "boolean" }, jwk: { 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" ] }, jwkThumbprint: { type: "string" }, kmsKeyRef: { type: "string" }, method: { type: "string", const: "x5c" }, opts: { anyOf: [ { type: "object", properties: { method: { type: "string", const: "jwk" }, identifier: { 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" ] }, kmsKeyRef: { type: "string" }, issuer: { type: "string" }, kid: { type: "string" }, clientId: { type: "string" }, clientIdScheme: { type: "string" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "x5c" }, identifier: { type: "array", items: { type: "string" } }, kmsKeyRef: { type: "string" }, issuer: { type: "string" }, kid: { type: "string" }, clientId: { type: "string" }, clientIdScheme: { type: "string" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "did" }, identifier: { anyOf: [ { $ref: "#/components/schemas/IIdentifier" }, { type: "string" } ] }, kmsKeyRef: { type: "string" }, issuer: { type: "string" }, kid: { type: "string" }, clientId: { type: "string" }, clientIdScheme: { type: "string" }, keyType: { $ref: "#/components/schemas/TKeyType" }, offlineWhenNoDIDRegistered: { type: "boolean" }, noVerificationMethodFallback: { type: "boolean" }, controllerKey: { type: "boolean" }, vmRelationship: { $ref: "#/components/schemas/DIDDocumentSection" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "kid" }, identifier: { type: "string" }, kmsKeyRef: { type: "string" }, issuer: { type: "string" }, kid: { type: "string" }, clientId: { type: "string" }, clientIdScheme: { type: "string" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "key" }, identifier: { $ref: "#/components/schemas/IKey" }, kmsKeyRef: { type: "string" }, issuer: { type: "string" }, kid: { type: "string" }, clientId: { type: "string" }, clientIdScheme: { type: "string" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "cose_key" }, identifier: { type: "object", properties: { kty: { type: "number", enum: [ 1, 2, 3, 4, 0 ] }, kid: { type: "string" }, alg: { type: "number", enum: [ -7, -47, -35, -36, -8, 4, 5, 6, 7, -37, -38, -39 ] }, key_ops: { type: "array", items: { type: "number", enum: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] } }, baseIV: { type: "string" }, crv: { type: "number", enum: [ 1, 2, 3, 4, 5, 6, 7, -1 ] }, x: { type: "string" }, y: { type: "string" }, d: { type: "string" }, x5chain: { type: "array", items: { type: "string" } } }, required: [ "kty" ], additionalProperties: {}, description: "See our mdl-mdoc and crypto library for more information https://github.com/Sphereon-Opensource/mdoc-cbor-crypto-multiplatform\n\nConversion functions are available in above library. Conversion functions are also available for TS in our" }, kmsKeyRef: { type: "string" }, issuer: { type: "string" }, kid: { type: "string" }, clientId: { type: "string" }, clientIdScheme: { type: "string" } }, required: [ "identifier" ] }, { type: "object", properties: { method: { type: "string", const: "oid4vci-issuer" }, identifier: { type: "string" }, kmsKeyRef: { type: "string" }, issuer: { type: "string" }, kid: { type: "string" }, clientId: { type: "string" }, clientIdScheme: { type: "string" } }, required: [ "identifier" ] } ] }, key: { $ref: "#/components/schemas/IKey" }, kid: { type: "string" }, issuer: { type: "string" }, clientId: { type: "string" }, clientIdScheme: { type: "string" }, identifier: { anyOf: [ { $ref: "#/components/schemas/IIdentifier" }, { 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" ] }, { $ref: "#/components/schemas/IKey" }, { type: "object", properties: { kty: { type: "number", enum: [ 1, 2, 3, 4, 0 ] }, kid: { type: "string" }, alg: { type: "number", enum: [ -7, -47, -35, -36, -8, 4, 5, 6, 7, -37, -38, -39 ] }, key_ops: { type: "array", items: { type: "number", enum: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ] } }, baseIV: { type: "string" }, crv: { type: "number", enum: [ 1, 2, 3, 4, 5, 6, 7, -1 ] }, x: { type: "string" }, y: { type: "string" }, d: { type: "string" }, x5chain: { type: "array", items: { type: "string" } } }, required: [ "kty" ], additionalProperties: {}, description: "See our mdl-mdoc and crypto library for more information https://github.com/Sphereon-Opensource/mdoc-cbor-crypto-multiplatform\n\nConversion functions are available in above library. Conversion functions are also available for TS in our" } ], description: "Use whenever we need to pass in an identifier. We can pass in kids, DIDs, IIdentifier objects and x5chains\n\nThe functions below can be used to check the type, and they also provide the proper 'runtime' types" }, x5c: { type: "array", items: { type: "string" } }, certificate: {} }, required: [ "certificate", "identifier", "jwk", "jwkThumbprint", "key", "kmsKeyRef", "method", "opts", "x5c" ] }, { type: "object", properties: { noIssPayloadUpdate: { type: "boolean" }, noIdentifierInHeader: { type: "boolean" }, lazyDisabled: { type: "boolean" }, jwk: { 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" ] }, jwkThumbprint: { type: "string" }, kmsKeyRef: { type: "string" }, method: { type: "string", const: "did" }, opts: { anyOf: [ { type: "object", properties: { method: { type: "string", const: "jwk" }, identifier: { type: "object", properties: {