@keetanetwork/anchor 0.0.22 → 0.0.24
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/lib/certificates.d.ts +4 -1
- package/lib/certificates.d.ts.map +1 -1
- package/lib/certificates.js +148 -14
- package/lib/certificates.js.map +1 -1
- package/lib/error.d.ts +33 -0
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +203 -9
- package/lib/error.js.map +1 -1
- package/lib/http-server/common.d.ts +17 -0
- package/lib/http-server/common.d.ts.map +1 -0
- package/lib/http-server/common.js +111 -0
- package/lib/http-server/common.js.map +1 -0
- package/lib/{http-server.d.ts → http-server/index.d.ts} +27 -11
- package/lib/http-server/index.d.ts.map +1 -0
- package/lib/{http-server.js → http-server/index.js} +73 -44
- package/lib/http-server/index.js.map +1 -0
- package/lib/resolver.d.ts +32 -9
- package/lib/resolver.d.ts.map +1 -1
- package/lib/resolver.js +558 -304
- package/lib/resolver.js.map +1 -1
- package/lib/utils/asn1.d.ts +0 -13
- package/lib/utils/asn1.d.ts.map +1 -1
- package/lib/utils/asn1.js +0 -1973
- package/lib/utils/asn1.js.map +1 -1
- package/lib/utils/external.d.ts.map +1 -1
- package/lib/utils/external.js +9 -2
- package/lib/utils/external.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/services/asset-movement/client.d.ts +22 -11
- package/services/asset-movement/client.d.ts.map +1 -1
- package/services/asset-movement/client.js +406 -95
- package/services/asset-movement/client.js.map +1 -1
- package/services/asset-movement/common.d.ts +410 -35
- package/services/asset-movement/common.d.ts.map +1 -1
- package/services/asset-movement/common.js +10176 -1492
- package/services/asset-movement/common.js.map +1 -1
- package/services/asset-movement/server.d.ts +26 -15
- package/services/asset-movement/server.d.ts.map +1 -1
- package/services/asset-movement/server.js +248 -76
- package/services/asset-movement/server.js.map +1 -1
- package/services/fx/common.d.ts +2 -5
- package/services/fx/common.d.ts.map +1 -1
- package/services/fx/common.js +3 -3
- package/services/fx/common.js.map +1 -1
- package/services/fx/server.d.ts +2 -2
- package/services/fx/server.d.ts.map +1 -1
- package/services/fx/server.js +2 -2
- package/services/fx/server.js.map +1 -1
- package/services/kyc/common.d.ts +2 -5
- package/services/kyc/common.d.ts.map +1 -1
- package/services/kyc/common.generated.js +4 -4
- package/services/kyc/common.js.map +1 -1
- package/services/kyc/iso20022.generated.js +54 -54
- package/services/kyc/iso20022.generated.js.map +1 -1
- package/services/kyc/server.d.ts +2 -2
- package/services/kyc/server.d.ts.map +1 -1
- package/services/kyc/server.js +2 -2
- package/services/kyc/server.js.map +1 -1
- package/services/kyc/utils/generate-kyc-schema.js +34 -6
- package/services/kyc/utils/generate-kyc-schema.js.map +1 -1
- package/lib/http-server.d.ts.map +0 -1
- package/lib/http-server.js.map +0 -1
package/lib/utils/asn1.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asn1.js","sourceRoot":"","sources":["../../../src/lib/utils/asn1.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AASjD,MAAM,eAAe,GAA+B,WAAW,CAAC,OAAO,CAAC;AASxE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvD,MAAM,IAAI,GAAkC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;AAEnE,MAAM,QAAQ,GAAyB,IAAI,CAAC,QAAQ,CAAC;AACrD,MAAM,QAAQ,GAAyB,IAAI,CAAC,QAAQ,CAAC;AACrD,MAAM,iBAAiB,GA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AC,GAAG,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACvD,CAAC;QACD,OAAM,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED,OAAM,CAAC,KAAK,CAAC,CAAC;AACf,CAAC;AAUD,OAAO,EACN,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\nimport type * as ASN1Types from '@keetanetwork/keetanet-client/lib/utils/asn1.ts';\nimport { isReferenceSchema } from './asn1.generated.js';\nimport { EncryptedContainer } from '../encrypted-container.js';\nimport { Buffer, bufferToArrayBuffer } from './buffer.js';\nimport { checkHashWithOID } from './external.js';\n\n/* ENUM */\ntype AccountKeyAlgorithm = InstanceType<typeof KeetaNetLib.Account>['keyType'];\n\n/**\n * An alias for the KeetaNetAccount type\n */\ntype KeetaNetAccount = ReturnType<typeof KeetaNetLib.Account.fromSeed<AccountKeyAlgorithm>>;\nconst KeetaNetAccount: typeof KeetaNetLib.Account = KeetaNetLib.Account;\n\n/*\n * We import this file to make sure that the `asn1js` types are\n * defined, since they are required by the `ASN1toJS` and `JStoASN1`\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type * as _ignored_asn1js from 'asn1js';\n\nimport { assert, createAssert, createIs } from 'typia';\n\nconst ASN1: typeof KeetaNetLib.Utils.ASN1 = KeetaNetLib.Utils.ASN1;\n\nconst ASN1toJS: typeof ASN1.ASN1toJS = ASN1.ASN1toJS;\nconst JStoASN1: typeof ASN1.JStoASN1 = ASN1.JStoASN1;\nconst BufferStorageASN1: typeof ASN1.BufferStorageASN1 = ASN1.BufferStorageASN1;\nconst ValidateASN1: typeof ASN1.ValidateASN1 = ASN1.ValidateASN1;\nconst ASN1CheckUtilities: typeof ASN1.ASN1CheckUtilities = ASN1.ASN1CheckUtilities;\n\nconst { isASN1ContextTag, isASN1Struct, isASN1String, isASN1Date, isASN1BitString, isASN1Set } = ASN1CheckUtilities;\n\ntype ASN1AnyJS = ASN1Types.ASN1AnyJS;\ntype ASN1OID = ASN1Types.ASN1OID;\ntype ASN1ContextTag = ASN1Types.ASN1ContextTag;\ntype Schema = ASN1Types.ValidateASN1.Schema;\ntype SchemaMap<T extends Schema> = ASN1Types.ValidateASN1.SchemaMap<T>;\ntype StructFieldSchema = Schema | { optional: Schema };\ntype StructSchema = Extract<Schema, { type: 'struct' }>;\ntype StructFieldSchemaMap = { [field: string]: StructFieldSchema };\ntype SchemaPreparer = (schema: Schema, value: unknown) => unknown;\n\ntype EncodeOptions = {\n\tattributeName?: string;\n\tvaluePrinter?: (value: unknown) => string;\n};\n\nconst assertStructFieldSchemaMap = createAssert<StructFieldSchemaMap>();\nconst structSchemaGuard = createIs<StructSchema>();\n\nconst structSchemaCache = new WeakMap<StructSchema, Schema>();\n\nfunction defaultPrintValue(value: unknown): string {\n\ttry {\n\t\treturn(JSON.stringify(value));\n\t} catch {\n\t\treturn(String(value));\n\t}\n}\n\nfunction isOptionalSchema(candidate: unknown): candidate is { optional: Schema } {\n\treturn(typeof candidate === 'object' && candidate !== null && 'optional' in candidate);\n}\n\nfunction isStructSchema(candidate: Schema): candidate is StructSchema {\n\treturn(structSchemaGuard(candidate));\n}\n\nfunction ensureStructContains(schema: StructSchema): StructFieldSchemaMap {\n\tif (!schema.contains) {\n\t\treturn({});\n\t}\n\treturn(assertStructFieldSchemaMap(schema.contains));\n}\n\nfunction isPlainObject(value: unknown): value is { [key: string]: unknown } {\n\treturn(typeof value === 'object' && value !== null && !Array.isArray(value));\n}\n\nfunction getFieldNames(schema: StructSchema): string[] {\n\treturn(Array.isArray(schema.fieldNames) && schema.fieldNames.length > 0\n\t\t? [...schema.fieldNames]\n\t\t: Object.keys(ensureStructContains(schema)));\n}\n\nexport function contextualizeStructSchema(schema: Schema): Schema {\n\tif (!isStructSchema(schema)) {\n\t\treturn(schema);\n\t}\n\n\tconst cached = structSchemaCache.get(schema);\n\tif (cached) {\n\t\treturn(cached);\n\t}\n\n\tconst fieldNames = getFieldNames(schema);\n\tconst structContains = ensureStructContains(schema);\n\tconst contextualizedContains: StructFieldSchemaMap = {};\n\n\tfunction wrapWithExplicitContext(index: number, innerSchema: Schema): Schema {\n\t\tif (typeof innerSchema === 'object' && innerSchema !== null && 'type' in innerSchema && innerSchema.type === 'context') {\n\t\t\treturn(innerSchema);\n\t\t}\n\t\treturn({\n\t\t\ttype: 'context',\n\t\t\tkind: 'explicit',\n\t\t\tvalue: index,\n\t\t\tcontains: contextualizeStructSchema(innerSchema)\n\t\t});\n\t}\n\n\tfor (const [index, fieldName] of fieldNames.entries()) {\n\t\tconst fieldSchema = structContains[fieldName];\n\t\tif (!fieldSchema) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (isOptionalSchema(fieldSchema)) {\n\t\t\tcontextualizedContains[fieldName] = {\n\t\t\t\toptional: wrapWithExplicitContext(index, fieldSchema.optional)\n\t\t\t};\n\t\t\tcontinue;\n\t\t}\n\t\tcontextualizedContains[fieldName] = wrapWithExplicitContext(index, fieldSchema);\n\t}\n\n\tconst contextualized: Schema = {\n\t\ttype: 'struct',\n\t\tfieldNames,\n\t\tcontains: contextualizedContains\n\t};\n\n\tstructSchemaCache.set(schema, contextualized);\n\treturn(contextualized);\n}\n\nfunction resolveSchema(schema: Schema): Schema {\n\tlet current: Schema = schema;\n\twhile (typeof current === 'function') {\n\t\tcurrent = current();\n\t}\n\treturn(current);\n}\n\nfunction prepareContextValue(schema: Extract<Schema, { type: 'context' }>, value: unknown, prepare: SchemaPreparer): unknown {\n\tif (value === undefined) {\n\t\treturn(value);\n\t}\n\tif (isASN1ContextTag(value)) {\n\t\tconst preparedContains = prepare(schema.contains, value.contains);\n\t\tif (preparedContains !== value.contains) {\n\t\t\treturn({\n\t\t\t\ttype: 'context',\n\t\t\t\tkind: value.kind,\n\t\t\t\tvalue: value.value,\n\t\t\t\tcontains: preparedContains\n\t\t\t});\n\t\t}\n\t\treturn(value);\n\t}\n\tconst contains = prepare(schema.contains, value);\n\treturn({\n\t\ttype: 'context',\n\t\tkind: schema.kind,\n\t\tvalue: schema.value,\n\t\tcontains\n\t});\n}\n\nfunction prepareStructValue(schema: StructSchema, value: unknown): unknown {\n\tconst structContains = schema.contains ?? {};\n\tconst fieldNames = getFieldNames(schema);\n\n\tif (isASN1Struct(value)) {\n\t\tconst preparedContains: { [key: string]: unknown } = {};\n\t\tfor (const [fieldName, fieldValue] of Object.entries(value.contains ?? {})) {\n\t\t\tconst fieldSchema = structContains[fieldName];\n\t\t\tif (!fieldSchema) {\n\t\t\t\tpreparedContains[fieldName] = fieldValue;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst innerSchema = isOptionalSchema(fieldSchema) ? fieldSchema.optional : fieldSchema;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\t\tpreparedContains[fieldName] = prepareValueForSchema(innerSchema, fieldValue);\n\t\t}\n\t\treturn({\n\t\t\ttype: 'struct',\n\t\t\tfieldNames: value.fieldNames ?? fieldNames,\n\t\t\tcontains: preparedContains\n\t\t});\n\t}\n\n\tif (!isPlainObject(value)) {\n\t\treturn(value);\n\t}\n\n\tconst preparedContains: { [key: string]: unknown } = {};\n\tfor (const fieldName of fieldNames) {\n\t\tconst fieldSchema = structContains[fieldName];\n\t\tif (!fieldSchema) {\n\t\t\tcontinue;\n\t\t}\n\t\tconst fieldValue = value[fieldName];\n\t\tif (fieldValue === undefined) {\n\t\t\tif (!isOptionalSchema(fieldSchema)) {\n\t\t\t\tpreparedContains[fieldName] = fieldValue;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tconst innerSchema = isOptionalSchema(fieldSchema) ? fieldSchema.optional : fieldSchema;\n\t\t// eslint-disable-next-line @typescript-eslint/no-use-before-define\n\t\tpreparedContains[fieldName] = prepareValueForSchema(innerSchema, fieldValue);\n\t}\n\n\treturn({\n\t\ttype: 'struct',\n\t\tfieldNames,\n\t\tcontains: preparedContains\n\t});\n}\n\nfunction prepareValueForSchema(schema: Schema, value: unknown): unknown {\n\tconst resolved = resolveSchema(schema);\n\n\tif (value === undefined || value === null) {\n\t\treturn(value);\n\t}\n\n\tif (Array.isArray(resolved)) {\n\t\tif (!Array.isArray(value)) {\n\t\t\treturn(value);\n\t\t}\n\t\tconst result = [];\n\t\tfor (let i = 0; i < resolved.length; i++) {\n\t\t\tresult.push(prepareValueForSchema(assert<Schema>(resolved[i]), value[i]));\n\t\t}\n\t\treturn(result);\n\t}\tif (typeof resolved === 'object' && resolved !== null) {\n\t\tif ('optional' in resolved) {\n\t\t\tif (value === undefined) {\n\t\t\t\treturn(undefined);\n\t\t\t}\n\t\t\treturn(prepareValueForSchema(resolved.optional, value));\n\t\t}\n\t\tif ('sequenceOf' in resolved) {\n\t\t\tif (!Array.isArray(value)) {\n\t\t\t\treturn(value);\n\t\t\t}\n\t\t\treturn(value.map(item => prepareValueForSchema(resolved.sequenceOf, item)));\n\t\t}\n\t\tif ('choice' in resolved) {\n\t\t\tconst choices = Array.isArray(resolved.choice)\n\t\t\t\t? resolved.choice\n\t\t\t\t: Object.values(resolved.choice);\n\t\t\tfor (const choiceSchema of choices) {\n\t\t\t\tconst preparedChoice = prepareValueForSchema(choiceSchema, value);\n\t\t\t\tif (preparedChoice !== value) {\n\t\t\t\t\treturn(preparedChoice);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn(value);\n\t\t}\n\t\tif ('type' in resolved) {\n\t\t\tswitch (resolved.type) {\n\t\t\t\tcase 'context':\n\t\t\t\t\treturn(prepareContextValue(resolved, value, prepareValueForSchema));\n\t\t\t\tcase 'struct':\n\t\t\t\t\treturn(prepareStructValue(resolved, value));\n\t\t\t\tdefault:\n\t\t\t\t\treturn(value);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn(value);\n}\n\nexport function encodeValueBySchema(schema: Schema, value: unknown, options?: EncodeOptions): ASN1AnyJS {\n\tconst contextualized = contextualizeStructSchema(schema);\n\ttry {\n\t\tconst preparedUnknown = prepareValueForSchema(contextualized, value);\n\t\t// XXX:TODO Fix depth issue\n\t\t// @ts-ignore\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/consistent-type-assertions\n\t\treturn(ValidateASN1.againstSchema(preparedUnknown as ASN1AnyJS, contextualized));\n\t} catch (err) {\n\t\tconst printer = options?.valuePrinter ?? defaultPrintValue;\n\t\tconst prefix = options?.attributeName ? `Attribute ${options.attributeName}: ` : '';\n\t\tconst message = err instanceof Error ? err.message : String(err);\n\n\t\tthrow(new Error(`${prefix}${message} (value: ${printer(value)})`));\n\t}\n}\n\nexport function normalizeDecodedASN1(input: unknown, principals: KeetaNetAccount[]): unknown {\n\tif (input === undefined || input === null) {\n\t\treturn(input);\n\t}\n\tif (Array.isArray(input)) {\n\t\treturn(input.map(function(childInput) {\n\t\t\treturn(normalizeDecodedASN1(childInput, principals));\n\t\t}));\n\t}\n\tif (input instanceof Date) {\n\t\treturn(input);\n\t}\n\tif (Buffer.isBuffer(input) || input instanceof ArrayBuffer) {\n\t\treturn(input);\n\t}\n\tif (isASN1ContextTag(input)) {\n\t\treturn(normalizeDecodedASN1(input.contains, principals));\n\t}\n\tif (isASN1String(input)) {\n\t\treturn(normalizeDecodedASN1(input.value, principals));\n\t}\n\tif (isASN1Date(input)) {\n\t\treturn(input.date);\n\t}\n\tif (isASN1BitString(input)) {\n\t\treturn(input.value);\n\t}\n\tif (isASN1Struct(input)) {\n\t\tconst contains = input.contains ?? {};\n\t\tconst orderedNames = Array.isArray(input.fieldNames) && input.fieldNames.length > 0\n\t\t\t? input.fieldNames\n\t\t\t: Object.keys(contains);\n\t\tconst result: { [key: string]: unknown } = {};\n\t\tfor (const fieldName of orderedNames) {\n\t\t\tif (!Object.prototype.hasOwnProperty.call(contains, fieldName)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst fieldValue = contains[fieldName];\n\t\t\tif (fieldValue !== undefined) {\n\t\t\t\tresult[fieldName] = normalizeDecodedASN1(fieldValue, principals);\n\t\t\t}\n\t\t}\n\n\t\tif (isReferenceSchema(input)) {\n\t\t\tconst url = input.contains.external.contains.url.value;\n\t\t\tconst mimeType = input.contains.external.contains.contentType.value;\n\t\t\tconst encryptionAlgoOID = input.contains.encryptionAlgorithm?.oid;\n\t\t\tconst digestInfo = input.contains.digest.contains;\n\t\t\tlet cachedValue: Blob | null = null;\n\t\t\tresult['$blob'] = async function(additionalPrincipals?: ConstructorParameters<typeof EncryptedContainer>[0]): Promise<Blob> {\n\t\t\t\t/*\n\t\t\t\t * If we already have the cached value, return it\n\t\t\t\t */\n\t\t\t\tif (cachedValue) {\n\t\t\t\t\treturn(cachedValue);\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * Fetch the remote data\n\t\t\t\t */\n\t\t\t\tconst result = await fetch(url);\n\t\t\t\tif (!result.ok) {\n\t\t\t\t\tthrow(new Error(`Failed to fetch remote data from ${url}: ${result.status} ${result.statusText}`));\n\t\t\t\t}\n\n\t\t\t\tconst dataBlob = await result.blob();\n\t\t\t\tlet data = await dataBlob.arrayBuffer();\n\n\t\t\t\t/*\n\t\t\t\t * Sometimes people like to encode the data\n\t\t\t\t * in a JSON base64 string, check to see if\n\t\t\t\t * that's the case -- hopefully this doesn't\n\t\t\t\t * conflict with any legitimate use case\n\t\t\t\t */\n\t\t\t\tif (dataBlob.type === 'application/json') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst asJSON: unknown = JSON.parse(Buffer.from(data).toString('utf-8'));\n\t\t\t\t\t\tif (isPlainObject(asJSON)) {\n\t\t\t\t\t\t\tif (Object.keys(asJSON).length === 2) {\n\t\t\t\t\t\t\t\tif ('data' in asJSON && typeof asJSON.data === 'string' && 'mimeType' in asJSON && typeof asJSON.mimeType === 'string') {\n\t\t\t\t\t\t\t\t\tdata = bufferToArrayBuffer(Buffer.from(asJSON.data, 'base64'));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t/* Ignored */\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * Decrypt the data, if encrypted\n\t\t\t\t */\n\t\t\t\tif (encryptionAlgoOID) {\n\t\t\t\t\tswitch (encryptionAlgoOID) {\n\t\t\t\t\t\tcase '1.3.6.1.4.1.62675.2':\n\t\t\t\t\t\tcase 'KeetaEncryptedContainerV1': {\n\t\t\t\t\t\t\tconst container = EncryptedContainer.fromEncryptedBuffer(data, [\n\t\t\t\t\t\t\t\t...principals,\n\t\t\t\t\t\t\t\t...(additionalPrincipals ?? [])\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tdata = await container.getPlaintext();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tthrow(new Error(`Unsupported encryption algorithm OID: ${encryptionAlgoOID}`));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * Compute and verify the hash (of the plain text)\n\t\t\t\t */\n\t\t\t\tif (!Buffer.isBuffer(digestInfo.digest)) {\n\t\t\t\t\tthrow(new TypeError('Digest value is not a buffer'));\n\t\t\t\t}\n\t\t\t\tconst validHash = await checkHashWithOID(data, {\n\t\t\t\t\tdigest: digestInfo.digest,\n\t\t\t\t\tdigestAlgorithm: digestInfo.digestAlgorithm\n\t\t\t\t});\n\t\t\t\tif (validHash !== true) {\n\t\t\t\t\tthrow(validHash);\n\t\t\t\t}\n\n\t\t\t\tconst blob = new Blob([data], { type: mimeType });\n\t\t\t\tcachedValue = blob;\n\t\t\t\treturn(blob);\n\t\t\t}\n\t\t}\n\t\treturn(result);\n\t}\n\tif (isASN1Set(input)) {\n\t\treturn({\n\t\t\tname: normalizeDecodedASN1(input.name, principals),\n\t\t\tvalue: normalizeDecodedASN1(input.value, principals)\n\t\t});\n\t}\n\tif (isPlainObject(input)) {\n\t\tconst result: { [key: string]: unknown } = {};\n\t\tfor (const [key, value] of Object.entries(input)) {\n\t\t\tresult[key] = normalizeDecodedASN1(value, principals);\n\t\t}\n\t\treturn(result);\n\t}\n\n\treturn(input);\n}\n\nexport type {\n\tASN1AnyJS,\n\tASN1OID,\n\tASN1ContextTag,\n\tSchema,\n\tSchemaMap\n};\n\nexport {\n\tASN1toJS,\n\tJStoASN1,\n\tBufferStorageASN1,\n\tValidateASN1\n};\n"]}
|
|
1
|
+
{"version":3,"file":"asn1.js","sourceRoot":"","sources":["../../../src/lib/utils/asn1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGnE,MAAM,IAAI,GAAkC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC;AAEnE,MAAM,QAAQ,GAAyB,IAAI,CAAC,QAAQ,CAAC;AACrD,MAAM,QAAQ,GAAyB,IAAI,CAAC,QAAQ,CAAC;AACrD,MAAM,iBAAiB,GAAkC,IAAI,CAAC,iBAAiB,CAAC;AAChF,MAAM,YAAY,GAA6B,IAAI,CAAC,YAAY,CAAC;AAgBjE,OAAO,EACN,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACZ,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\nimport type * as ASN1Types from '@keetanetwork/keetanet-client/lib/utils/asn1.ts';\n\nconst ASN1: typeof KeetaNetLib.Utils.ASN1 = KeetaNetLib.Utils.ASN1;\n\nconst ASN1toJS: typeof ASN1.ASN1toJS = ASN1.ASN1toJS;\nconst JStoASN1: typeof ASN1.JStoASN1 = ASN1.JStoASN1;\nconst BufferStorageASN1: typeof ASN1.BufferStorageASN1 = ASN1.BufferStorageASN1;\nconst ValidateASN1: typeof ASN1.ValidateASN1 = ASN1.ValidateASN1;\n\ntype ASN1AnyJS = ASN1Types.ASN1AnyJS;\ntype ASN1OID = ASN1Types.ASN1OID;\ntype ASN1ContextTag = ASN1Types.ASN1ContextTag;\ntype Schema = ASN1Types.ValidateASN1.Schema;\ntype SchemaMap<T extends Schema> = ASN1Types.ValidateASN1.SchemaMap<T>;\n\nexport type {\n\tASN1AnyJS,\n\tASN1OID,\n\tASN1ContextTag,\n\tSchema,\n\tSchemaMap\n};\n\nexport {\n\tASN1toJS,\n\tJStoASN1,\n\tBufferStorageASN1,\n\tValidateASN1\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/external.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAqB,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEzG,OAAO,EAAE,MAAM,EAAuB,MAAM,aAAa,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,wBAAwB;;IAMpC;;;;;OAKG;gBACS,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAK5C;;;;;OAKG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAK5C;;;;;OAKG;IACH,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAKhD;;;;;OAKG;IACH,KAAK,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS;CA4EzC;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AAEjH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/external.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAqB,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEzG,OAAO,EAAE,MAAM,EAAuB,MAAM,aAAa,CAAC;AAE1D;;;;;;;GAOG;AACH,qBAAa,wBAAwB;;IAMpC;;;;;OAKG;gBACS,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAK5C;;;;;OAKG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAK5C;;;;;OAKG;IACH,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAKhD;;;;;OAKG;IACH,KAAK,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS;CA4EzC;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AAEjH,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;AAiD9G,eAAe,wBAAwB,CAAC"}
|
package/lib/utils/external.js
CHANGED
|
@@ -120,10 +120,17 @@ export async function checkHashWithOID(input, expected) {
|
|
|
120
120
|
if (typeof expected !== 'object' || expected === null || !('digestAlgorithm' in expected) || !('digest' in expected)) {
|
|
121
121
|
return (new Error('Invalid expected DigestInfo structure'));
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
// digestAlgorithm can be either a string (OID) or an object {oid: string}
|
|
124
|
+
let hashAlgoOID;
|
|
125
|
+
if (typeof expected.digestAlgorithm === 'string') {
|
|
126
|
+
hashAlgoOID = expected.digestAlgorithm;
|
|
127
|
+
}
|
|
128
|
+
else if (typeof expected.digestAlgorithm === 'object' && expected.digestAlgorithm !== null && 'oid' in expected.digestAlgorithm && typeof expected.digestAlgorithm.oid === 'string') {
|
|
129
|
+
hashAlgoOID = expected.digestAlgorithm.oid;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
124
132
|
return (new Error('Invalid digestAlgorithm in expected DigestInfo'));
|
|
125
133
|
}
|
|
126
|
-
const hashAlgoOID = expected.digestAlgorithm.oid;
|
|
127
134
|
const hashValue = expected.digest;
|
|
128
135
|
switch (hashAlgoOID) {
|
|
129
136
|
case '2.16.840.1.101.3.4.2.8':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../../src/lib/utils/external.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,OAAO,wBAAwB;IACpC,IAAI,CAAS;IACb,YAAY,CAAS;IACrB,gBAAgB,GAAG,UAAU,CAAC;IAC9B,oBAAoB,GAAG,2BAA2B,CAAC;IAEnD;;;;;OAKG;IACH,YAAY,GAAW,EAAE,WAAmB;QAC3C,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACH,mBAAmB,CAAC,SAAiB;QACpC,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAClC,OAAM,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,uBAAuB,CAAC,SAAiB;QACxC,IAAI,CAAC,oBAAoB,GAAG,SAAS,CAAC;QACtC,OAAM,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAuB;QAC5B,yCAAyC;QACzC,MAAM,iBAAiB,GAAsB;YAC5C,GAAG,EAAE,IAAI,CAAC,IAAI;YACd,WAAW,EAAE,IAAI,CAAC,YAAY;SAC9B,CAAC;QAEF,oDAAoD;QACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACxE,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAA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K,wBAAwB,CAAC;QAC9B,KAAK,QAAQ,CAAC;QACd,KAAK,UAAU;YACd,QAAQ,GAAG,QAAQ,CAAC;YACpB,MAAM;QACP;YACC,OAAM,CAAC,IAAI,KAAK,CAAC,qCAAqC,WAAW,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACP,gBAAgB,CAAC,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC;IAC5C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,OAAM,CAAC,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAClC,OAAM,CAAC,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,OAAM,CAAC,IAAI,CAAC,CAAC;AACd,CAAC;AAED,eAAe,wBAAwB,CAAC","sourcesContent":["import crypto from './crypto.js';\nimport type { Reference, ExternalReference, DigestInfo } from '../../services/kyc/iso20022.generated.js';\nimport type { ASN1OID } from './asn1.js';\nimport { Buffer, arrayBufferToBuffer } from './buffer.js';\n\n/**\n * Builder for Reference structures\n *\n * Creates a Reference containing:\n * - ExternalReference: URL and content type\n * - DigestInfo: Hash algorithm OID and digest\n * - Encryption algorithm OID\n */\nexport class ExternalReferenceBuilder {\n\t#url: string;\n\t#contentType: string;\n\t#digestAlgorithm = 'sha3-256';\n\t#encryptionAlgorithm = 'KeetaEncryptedContainerV1';\n\n\t/**\n\t * Create a new ExternalReferenceBuilder\n\t *\n\t * @param url - The URL where the document can be accessed\n\t * @param contentType - MIME type of the document (e.g., 'image/jpeg', 'application/pdf')\n\t */\n\tconstructor(url: string, contentType: string) {\n\t\tthis.#url = url;\n\t\tthis.#contentType = contentType;\n\t}\n\n\t/**\n\t * Set the digest algorithm (default: 'sha3-256')\n\t *\n\t * @param algorithm - Hash algorithm name (e.g., 'sha256', 'sha3-256')\n\t * @returns this builder for chaining\n\t */\n\twithDigestAlgorithm(algorithm: string): this {\n\t\tthis.#digestAlgorithm = algorithm;\n\t\treturn(this);\n\t}\n\n\t/**\n\t * Set the encryption algorithm (default: 'KeetaEncryptedContainerV1')\n\t *\n\t * @param algorithm - Encryption algorithm name\n\t * @returns this builder for chaining\n\t */\n\twithEncryptionAlgorithm(algorithm: string): this {\n\t\tthis.#encryptionAlgorithm = algorithm;\n\t\treturn(this);\n\t}\n\n\t/**\n\t * Build the Reference structure\n\t *\n\t * @param documentContent - The actual document content to hash\n\t * @returns The Reference structure\n\t */\n\tbuild(documentContent: Buffer): Reference {\n\t\t// Create the ExternalReference structure\n\t\tconst externalReference: ExternalReference = {\n\t\t\turl: this.#url,\n\t\t\tcontentType: this.#contentType\n\t\t};\n\n\t\t// Compute the digest of the actual document content\n\t\tconst hashAlgo = this.#digestAlgorithmToNodeAlgo(this.#digestAlgorithm);\n\t\tconst hash = crypto.createHash(hashAlgo);\n\t\thash.update(documentContent);\n\t\tconst digest = hash.digest();\n\n\t\t// Map algorithm names to OIDs\n\t\tconst digestAlgorithmOID = this.#algorithmToOID(this.#digestAlgorithm);\n\t\tconst encryptionAlgorithmOID = this.#algorithmToOID(this.#encryptionAlgorithm);\n\n\t\t// Create the RFC 3447 DigestInfo structure\n\t\tconst digestInfo: DigestInfo = {\n\t\t\tdigestAlgorithm: digestAlgorithmOID,\n\t\t\tdigest: digest\n\t\t};\n\n\t\t// Create the Reference structure\n\t\tconst reference: Reference = {\n\t\t\texternal: externalReference,\n\t\t\tdigest: digestInfo,\n\t\t\tencryptionAlgorithm: encryptionAlgorithmOID,\n\t\t\t$blob: async function() {\n\t\t\t\treturn(new Blob([documentContent], { type: this.external.contentType }));\n\t\t\t}\n\t\t};\n\n\t\treturn(reference);\n\t}\n\n\t/**\n\t * // XXX:TODO We can handle these better later\n\t * Map algorithm names to Node.js crypto algorithm names\n\t */\n\t#digestAlgorithmToNodeAlgo(algorithm: string): string {\n\t\tconst algoMap: { [key: string]: string } = {\n\t\t\t'sha256': 'sha256',\n\t\t\t'sha3-256': 'sha3-256',\n\t\t\t'sha2-256': 'sha256'\n\t\t};\n\n\t\tconst nodeAlgo = algoMap[algorithm.toLowerCase()];\n\t\tif (!nodeAlgo) {\n\t\t\tthrow(new Error(`Unsupported digest algorithm: ${algorithm}`));\n\t\t}\n\n\t\treturn(nodeAlgo);\n\t}\n\n\t/**\n\t * // XXX:TODO We can handle these better later\n\t * Map algorithm names to OIDs\n\t */\n\t#algorithmToOID(algorithm: string): ASN1OID {\n\t\tconst oidMap: { [key: string]: string } = {\n\t\t\t'sha256': '2.16.840.1.101.3.4.2.1',\n\t\t\t'sha2-256': '2.16.840.1.101.3.4.2.1',\n\t\t\t'sha3-256': '2.16.840.1.101.3.4.2.8',\n\t\t\t'aes-256-cbc': '2.16.840.1.101.3.4.1.42',\n\t\t\t'aes-256-gcm': '2.16.840.1.101.3.4.1.46',\n\t\t\t'keetaencryptedcontainerv1': '1.3.6.1.4.1.62675.2'\n\t\t};\n\n\t\tconst oid = oidMap[algorithm.toLowerCase()];\n\t\tif (!oid) {\n\t\t\tthrow(new Error(`Unsupported algorithm: ${algorithm}`));\n\t\t}\n\n\t\treturn({ type: 'oid', oid });\n\t}\n}\n\nexport async function checkHashWithOID(input: Buffer | ArrayBuffer, expected: DigestInfo): Promise<true | Error>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport async function checkHashWithOID(input: Buffer | ArrayBuffer, expected: unknown): Promise<true | Error>;\nexport async function checkHashWithOID(input: Buffer | ArrayBuffer, expected: unknown): Promise<true | Error> {\n\tlet hashAlgo: string;\n\tif (typeof expected !== 'object' || expected === null || !('digestAlgorithm' in expected) || !('digest' in expected)) {\n\t\treturn(new Error('Invalid expected DigestInfo structure'));\n\t}\n\tif (typeof expected.digestAlgorithm !== 'object' || expected.digestAlgorithm === null || !('oid' in expected.digestAlgorithm)) {\n\t\treturn(new Error('Invalid digestAlgorithm in expected DigestInfo'));\n\t}\n\n\tconst hashAlgoOID = expected.digestAlgorithm.oid;\n\tconst hashValue = expected.digest;\n\tswitch (hashAlgoOID) {\n\t\tcase '2.16.840.1.101.3.4.2.8':\n\t\tcase 'sha3-256':\n\t\t\thashAlgo = 'sha3-256';\n\t\t\tbreak;\n\t\tcase '2.16.840.1.101.3.4.2.1':\n\t\tcase 'sha256':\n\t\tcase 'sha2-256':\n\t\t\thashAlgo = 'sha256';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn(new Error(`Unsupported digest algorithm OID: ${hashAlgoOID}`));\n\t}\n\n\tconst checkHashBuilder = crypto.createHash(hashAlgo);\n\tif (Buffer.isBuffer(input)) {\n\t\tcheckHashBuilder.update(input);\n\t} else {\n\t\tcheckHashBuilder.update(arrayBufferToBuffer(input));\n\t}\n\tconst checkHash = checkHashBuilder.digest();\n\tif (!Buffer.isBuffer(hashValue)) {\n\t\treturn(new Error('internal error: Expected digest to be a Buffer'));\n\t}\n\tif (!checkHash.equals(hashValue)) {\n\t\treturn(new Error('Data integrity check failed: Hash mismatch'));\n\t}\n\n\treturn(true);\n}\n\nexport default ExternalReferenceBuilder;\n"]}
|
|
1
|
+
{"version":3,"file":"external.js","sourceRoot":"","sources":["../../../src/lib/utils/external.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AAGjC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,OAAO,wBAAw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C,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;SAAM,CAAC;QACP,gBAAgB,CAAC,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,SAAS,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC;IAC5C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,OAAM,CAAC,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QAClC,OAAM,CAAC,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,OAAM,CAAC,IAAI,CAAC,CAAC;AACd,CAAC;AAED,eAAe,wBAAwB,CAAC","sourcesContent":["import crypto from './crypto.js';\nimport type { Reference, ExternalReference, DigestInfo } from '../../services/kyc/iso20022.generated.js';\nimport type { ASN1OID } from './asn1.js';\nimport { Buffer, arrayBufferToBuffer } from './buffer.js';\n\n/**\n * Builder for Reference structures\n *\n * Creates a Reference containing:\n * - ExternalReference: URL and content type\n * - DigestInfo: Hash algorithm OID and digest\n * - Encryption algorithm OID\n */\nexport class ExternalReferenceBuilder {\n\t#url: string;\n\t#contentType: string;\n\t#digestAlgorithm = 'sha3-256';\n\t#encryptionAlgorithm = 'KeetaEncryptedContainerV1';\n\n\t/**\n\t * Create a new ExternalReferenceBuilder\n\t *\n\t * @param url - The URL where the document can be accessed\n\t * @param contentType - MIME type of the document (e.g., 'image/jpeg', 'application/pdf')\n\t */\n\tconstructor(url: string, contentType: string) {\n\t\tthis.#url = url;\n\t\tthis.#contentType = contentType;\n\t}\n\n\t/**\n\t * Set the digest algorithm (default: 'sha3-256')\n\t *\n\t * @param algorithm - Hash algorithm name (e.g., 'sha256', 'sha3-256')\n\t * @returns this builder for chaining\n\t */\n\twithDigestAlgorithm(algorithm: string): this {\n\t\tthis.#digestAlgorithm = algorithm;\n\t\treturn(this);\n\t}\n\n\t/**\n\t * Set the encryption algorithm (default: 'KeetaEncryptedContainerV1')\n\t *\n\t * @param algorithm - Encryption algorithm name\n\t * @returns this builder for chaining\n\t */\n\twithEncryptionAlgorithm(algorithm: string): this {\n\t\tthis.#encryptionAlgorithm = algorithm;\n\t\treturn(this);\n\t}\n\n\t/**\n\t * Build the Reference structure\n\t *\n\t * @param documentContent - The actual document content to hash\n\t * @returns The Reference structure\n\t */\n\tbuild(documentContent: Buffer): Reference {\n\t\t// Create the ExternalReference structure\n\t\tconst externalReference: ExternalReference = {\n\t\t\turl: this.#url,\n\t\t\tcontentType: this.#contentType\n\t\t};\n\n\t\t// Compute the digest of the actual document content\n\t\tconst hashAlgo = this.#digestAlgorithmToNodeAlgo(this.#digestAlgorithm);\n\t\tconst hash = crypto.createHash(hashAlgo);\n\t\thash.update(documentContent);\n\t\tconst digest = hash.digest();\n\n\t\t// Map algorithm names to OIDs\n\t\tconst digestAlgorithmOID = this.#algorithmToOID(this.#digestAlgorithm);\n\t\tconst encryptionAlgorithmOID = this.#algorithmToOID(this.#encryptionAlgorithm);\n\n\t\t// Create the RFC 3447 DigestInfo structure\n\t\tconst digestInfo: DigestInfo = {\n\t\t\tdigestAlgorithm: digestAlgorithmOID,\n\t\t\tdigest: digest\n\t\t};\n\n\t\t// Create the Reference structure\n\t\tconst reference: Reference = {\n\t\t\texternal: externalReference,\n\t\t\tdigest: digestInfo,\n\t\t\tencryptionAlgorithm: encryptionAlgorithmOID,\n\t\t\t$blob: async function() {\n\t\t\t\treturn(new Blob([documentContent], { type: this.external.contentType }));\n\t\t\t}\n\t\t};\n\n\t\treturn(reference);\n\t}\n\n\t/**\n\t * // XXX:TODO We can handle these better later\n\t * Map algorithm names to Node.js crypto algorithm names\n\t */\n\t#digestAlgorithmToNodeAlgo(algorithm: string): string {\n\t\tconst algoMap: { [key: string]: string } = {\n\t\t\t'sha256': 'sha256',\n\t\t\t'sha3-256': 'sha3-256',\n\t\t\t'sha2-256': 'sha256'\n\t\t};\n\n\t\tconst nodeAlgo = algoMap[algorithm.toLowerCase()];\n\t\tif (!nodeAlgo) {\n\t\t\tthrow(new Error(`Unsupported digest algorithm: ${algorithm}`));\n\t\t}\n\n\t\treturn(nodeAlgo);\n\t}\n\n\t/**\n\t * // XXX:TODO We can handle these better later\n\t * Map algorithm names to OIDs\n\t */\n\t#algorithmToOID(algorithm: string): ASN1OID {\n\t\tconst oidMap: { [key: string]: string } = {\n\t\t\t'sha256': '2.16.840.1.101.3.4.2.1',\n\t\t\t'sha2-256': '2.16.840.1.101.3.4.2.1',\n\t\t\t'sha3-256': '2.16.840.1.101.3.4.2.8',\n\t\t\t'aes-256-cbc': '2.16.840.1.101.3.4.1.42',\n\t\t\t'aes-256-gcm': '2.16.840.1.101.3.4.1.46',\n\t\t\t'keetaencryptedcontainerv1': '1.3.6.1.4.1.62675.2'\n\t\t};\n\n\t\tconst oid = oidMap[algorithm.toLowerCase()];\n\t\tif (!oid) {\n\t\t\tthrow(new Error(`Unsupported algorithm: ${algorithm}`));\n\t\t}\n\n\t\treturn({ type: 'oid', oid });\n\t}\n}\n\nexport async function checkHashWithOID(input: Buffer | ArrayBuffer, expected: DigestInfo): Promise<true | Error>;\n// eslint-disable-next-line @typescript-eslint/unified-signatures\nexport async function checkHashWithOID(input: Buffer | ArrayBuffer, expected: unknown): Promise<true | Error>;\nexport async function checkHashWithOID(input: Buffer | ArrayBuffer, expected: unknown): Promise<true | Error> {\n\tlet hashAlgo: string;\n\tif (typeof expected !== 'object' || expected === null || !('digestAlgorithm' in expected) || !('digest' in expected)) {\n\t\treturn(new Error('Invalid expected DigestInfo structure'));\n\t}\n\n\t// digestAlgorithm can be either a string (OID) or an object {oid: string}\n\tlet hashAlgoOID: string;\n\tif (typeof expected.digestAlgorithm === 'string') {\n\t\thashAlgoOID = expected.digestAlgorithm;\n\t} else if (typeof expected.digestAlgorithm === 'object' && expected.digestAlgorithm !== null && 'oid' in expected.digestAlgorithm && typeof expected.digestAlgorithm.oid === 'string') {\n\t\thashAlgoOID = expected.digestAlgorithm.oid;\n\t} else {\n\t\treturn(new Error('Invalid digestAlgorithm in expected DigestInfo'));\n\t}\n\n\tconst hashValue = expected.digest;\n\tswitch (hashAlgoOID) {\n\t\tcase '2.16.840.1.101.3.4.2.8':\n\t\tcase 'sha3-256':\n\t\t\thashAlgo = 'sha3-256';\n\t\t\tbreak;\n\t\tcase '2.16.840.1.101.3.4.2.1':\n\t\tcase 'sha256':\n\t\tcase 'sha2-256':\n\t\t\thashAlgo = 'sha256';\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn(new Error(`Unsupported digest algorithm OID: ${hashAlgoOID}`));\n\t}\n\n\tconst checkHashBuilder = crypto.createHash(hashAlgo);\n\tif (Buffer.isBuffer(input)) {\n\t\tcheckHashBuilder.update(input);\n\t} else {\n\t\tcheckHashBuilder.update(arrayBufferToBuffer(input));\n\t}\n\tconst checkHash = checkHashBuilder.digest();\n\tif (!Buffer.isBuffer(hashValue)) {\n\t\treturn(new Error('internal error: Expected digest to be a Buffer'));\n\t}\n\tif (!checkHash.equals(hashValue)) {\n\t\treturn(new Error('Data integrity check failed: Hash mismatch'));\n\t}\n\n\treturn(true);\n}\n\nexport default ExternalReferenceBuilder;\n"]}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keetanetwork/anchor",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@keetanetwork/anchor",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.24",
|
|
10
10
|
"license": "SEE LICENSE IN LICENSE",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@keetanetwork/currency-info": "1.2.5",
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
|
|
2
2
|
import { getDefaultResolver } from '../../config.js';
|
|
3
3
|
import type { UserClient as KeetaNetUserClient } from '@keetanetwork/keetanet-client';
|
|
4
|
-
import type {
|
|
4
|
+
import type { KeetaAssetMovementAnchorGetTransferStatusResponse, KeetaAssetMovementAnchorCreatePersistentForwardingResponse, SupportedAssets, ProviderSearchInput, KeetaAssetMovementAnchorlistPersistentForwardingTransactionsResponse, AssetTransferInstructions, KeetaAssetMovementAnchorCreatePersistentForwardingClientRequest, KeetaAssetMovementAnchorInitiateTransferClientRequest, KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateClientRequest, KeetaAssetMovementAnchorlistTransactionsClientRequest, KeetaAssetMovementAnchorListForwardingAddressTemplateClientRequest, PersistentAddressTemplateData, KeetaAssetMovementAnchorGetTransferStatusClientRequest, KeetaAssetMovementAnchorShareKYCClientRequest } from './common.js';
|
|
5
5
|
import type { Logger } from '../../lib/log/index.ts';
|
|
6
6
|
import Resolver from "../../lib/resolver.js";
|
|
7
|
-
import type { ServiceMetadata } from '../../lib/resolver.ts';
|
|
7
|
+
import type { ServiceMetadata, ServiceMetadataAuthenticationType } from '../../lib/resolver.ts';
|
|
8
8
|
import type { BrandedString } from '../../lib/utils/brand.js';
|
|
9
|
+
import type { ExtractOk } from '../../lib/http-server/common.js';
|
|
9
10
|
/**
|
|
10
11
|
* The configuration options for the Asset Movement (Inbound/Outbound) Anchor client.
|
|
11
12
|
*/
|
|
@@ -48,9 +49,14 @@ type ProviderID = BrandedString<'AssetMovementProviderID'>;
|
|
|
48
49
|
* A list of operations that can be performed by the Asset Movement Anchor service.
|
|
49
50
|
*/
|
|
50
51
|
type KeetaAssetMovementAnchorOperations = {
|
|
51
|
-
[operation in keyof NonNullable<ServiceMetadata['services']['assetMovement']>[string]['operations']]?:
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
[operation in keyof NonNullable<ServiceMetadata['services']['assetMovement']>[string]['operations']]?: {
|
|
53
|
+
url: (params?: {
|
|
54
|
+
[key: string]: string;
|
|
55
|
+
}) => URL;
|
|
56
|
+
options: {
|
|
57
|
+
authentication: ServiceMetadataAuthenticationType;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
54
60
|
};
|
|
55
61
|
/**
|
|
56
62
|
* The service information for a KYC Anchor service.
|
|
@@ -77,23 +83,27 @@ declare class KeetaAssetMovementTransfer {
|
|
|
77
83
|
private readonly provider;
|
|
78
84
|
private request;
|
|
79
85
|
private transfer;
|
|
80
|
-
constructor(provider: KeetaAssetMovementAnchorProvider, request:
|
|
86
|
+
constructor(provider: KeetaAssetMovementAnchorProvider, request: KeetaAssetMovementAnchorInitiateTransferClientRequest, transfer: {
|
|
81
87
|
id: string;
|
|
82
88
|
instructionChoices: AssetTransferInstructions[];
|
|
83
89
|
});
|
|
84
|
-
getTransferStatus(): Promise<KeetaAssetMovementAnchorGetTransferStatusResponse
|
|
90
|
+
getTransferStatus(): Promise<ExtractOk<KeetaAssetMovementAnchorGetTransferStatusResponse>>;
|
|
85
91
|
get transferId(): string;
|
|
86
92
|
get instructions(): AssetTransferInstructions[];
|
|
87
93
|
}
|
|
88
94
|
declare class KeetaAssetMovementAnchorProvider extends KeetaAssetMovementAnchorBase {
|
|
95
|
+
#private;
|
|
89
96
|
readonly serviceInfo: KeetaAssetMovementServiceInfo;
|
|
90
97
|
readonly providerID: ProviderID;
|
|
91
98
|
private readonly parent;
|
|
92
99
|
constructor(serviceInfo: KeetaAssetMovementServiceInfo, providerID: ProviderID, parent: KeetaAssetMovementAnchorClient);
|
|
93
|
-
initiateTransfer(request:
|
|
94
|
-
getTransferStatus(request:
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
initiateTransfer(request: KeetaAssetMovementAnchorInitiateTransferClientRequest): Promise<KeetaAssetMovementTransfer>;
|
|
101
|
+
getTransferStatus(request: KeetaAssetMovementAnchorGetTransferStatusClientRequest): Promise<ExtractOk<KeetaAssetMovementAnchorGetTransferStatusResponse>>;
|
|
102
|
+
createPersistentForwardingTemplate(request: KeetaAssetMovementAnchorCreatePersistentForwardingAddressTemplateClientRequest): Promise<ExtractOk<KeetaAssetMovementAnchorCreatePersistentForwardingResponse>>;
|
|
103
|
+
createPersistentForwardingAddress(request: KeetaAssetMovementAnchorCreatePersistentForwardingClientRequest): Promise<ExtractOk<KeetaAssetMovementAnchorCreatePersistentForwardingResponse>>;
|
|
104
|
+
listForwardingAddressTemplates(request: KeetaAssetMovementAnchorListForwardingAddressTemplateClientRequest): Promise<PersistentAddressTemplateData[]>;
|
|
105
|
+
listTransactions(request: KeetaAssetMovementAnchorlistTransactionsClientRequest): Promise<ExtractOk<KeetaAssetMovementAnchorlistPersistentForwardingTransactionsResponse>>;
|
|
106
|
+
shareKYCAttributes(request: KeetaAssetMovementAnchorShareKYCClientRequest): Promise<void>;
|
|
97
107
|
}
|
|
98
108
|
declare class KeetaAssetMovementAnchorClient extends KeetaAssetMovementAnchorBase {
|
|
99
109
|
#private;
|
|
@@ -101,6 +111,7 @@ declare class KeetaAssetMovementAnchorClient extends KeetaAssetMovementAnchorBas
|
|
|
101
111
|
readonly id: string;
|
|
102
112
|
constructor(client: KeetaNetUserClient, config?: KeetaAssetMovementClientConfig);
|
|
103
113
|
getProvidersForTransfer(request: ProviderSearchInput): Promise<KeetaAssetMovementAnchorProvider[] | null>;
|
|
114
|
+
getProviderByID(providerID: string): Promise<KeetaAssetMovementAnchorProvider | null>;
|
|
104
115
|
}
|
|
105
116
|
export default KeetaAssetMovementAnchorClient;
|
|
106
117
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/services/asset-movement/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EACX,UAAU,IAAI,kBAAkB,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACX
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/services/asset-movement/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,EACX,UAAU,IAAI,kBAAkB,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACX,iDAAiD,EAEjD,0DAA0D,EAC1D,eAAe,EACf,mBAAmB,EAEnB,oEAAoE,EACpE,yBAAyB,EACzB,+DAA+D,EAC/D,qDAAqD,EAErD,8EAA8E,EAG9E,qDAAqD,EACrD,kEAAkE,EAClE,6BAA6B,EAC7B,sDAAsD,EACtD,6CAA6C,EAG7C,MAAM,aAAa,CAAC;AAqBrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,iCAAiC,EAAiD,MAAM,uBAAuB,CAAC;AAE/I,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,iCAAiC,CAAC;AAQlF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC5C;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IAC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