@keetanetwork/anchor 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/lib/certificates.d.ts.map +1 -1
  2. package/lib/certificates.js +20 -100
  3. package/lib/certificates.js.map +1 -1
  4. package/lib/http-server.js +1 -1
  5. package/lib/http-server.js.map +1 -1
  6. package/lib/index.d.ts +2 -1
  7. package/lib/index.d.ts.map +1 -1
  8. package/lib/index.js +2 -1
  9. package/lib/index.js.map +1 -1
  10. package/lib/log/index.d.ts +6 -57
  11. package/lib/log/index.d.ts.map +1 -1
  12. package/lib/log/index.js +5 -205
  13. package/lib/log/index.js.map +1 -1
  14. package/lib/log/target_console.d.ts +3 -11
  15. package/lib/log/target_console.d.ts.map +1 -1
  16. package/lib/log/target_console.js +3 -42
  17. package/lib/log/target_console.js.map +1 -1
  18. package/lib/resolver.js +22 -22
  19. package/lib/uri.d.ts +28 -0
  20. package/lib/uri.d.ts.map +1 -0
  21. package/lib/uri.js +100 -0
  22. package/lib/uri.js.map +1 -0
  23. package/lib/utils/asn1.d.ts +9 -1
  24. package/lib/utils/asn1.d.ts.map +1 -1
  25. package/lib/utils/asn1.js +1413 -0
  26. package/lib/utils/asn1.js.map +1 -1
  27. package/lib/utils/buffer.d.ts +1 -1
  28. package/lib/utils/buffer.d.ts.map +1 -1
  29. package/lib/utils/buffer.js +8 -2
  30. package/lib/utils/buffer.js.map +1 -1
  31. package/lib/utils/external.d.ts +43 -0
  32. package/lib/utils/external.d.ts.map +1 -0
  33. package/lib/utils/external.js +115 -0
  34. package/lib/utils/external.js.map +1 -0
  35. package/npm-shrinkwrap.json +9 -9
  36. package/package.json +2 -2
  37. package/services/asset-movement/common.js +7 -7
  38. package/services/kyc/iso20022.generated.d.ts +89 -28
  39. package/services/kyc/iso20022.generated.d.ts.map +1 -1
  40. package/services/kyc/iso20022.generated.js +191 -88
  41. package/services/kyc/iso20022.generated.js.map +1 -1
  42. package/services/kyc/oids.generated.d.ts +24 -9
  43. package/services/kyc/oids.generated.d.ts.map +1 -1
  44. package/services/kyc/oids.generated.js +38 -15
  45. package/services/kyc/oids.generated.js.map +1 -1
  46. package/services/kyc/utils/generate-kyc-schema.js +305 -75
  47. package/services/kyc/utils/generate-kyc-schema.js.map +1 -1
  48. package/lib/log/common.d.ts +0 -35
  49. package/lib/log/common.d.ts.map +0 -1
  50. package/lib/log/common.js +0 -19
  51. package/lib/log/common.js.map +0 -1
@@ -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;AASnE,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,CAAA;AAC/E,MAAM,YAAY,GAA6B,IAAI,CAAC,YAAY,CAAC;AAcjE,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/*\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\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 ASN1ContextTag = ASN1Types.ASN1ContextTag;\ntype Schema = ASN1Types.ValidateASN1.Schema;\ntype SchemaMap<T extends Schema> = ASN1Types.ValidateASN1.SchemaMap<T>;\n\nexport type {\n\tASN1AnyJS,\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;AASnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,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,GAAkC,IAAI,CAAC,iBAAiB,CAAC;AAChF,MAAM,YAAY,GAA6B,IAAI,CAAC,YAAY,CAAC;AACjE,MAAM,kBAAkB,GAAmC,IAAI,CAAC,kBAAkB,CAAC;AAEnF,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,SAAS,EAAE,GAAG,kBAAkB,CAAC;AAiBpH,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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keetanetwork/keetanet-client';\nimport type * as ASN1Types from '@keetanetwork/keetanet-client/lib/utils/asn1.ts';\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 { Buffer } from './buffer.js';\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: Array.from(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): unknown {\n\tif (input === undefined || input === null) {\n\t\treturn(input);\n\t}\n\tif (Array.isArray(input)) {\n\t\treturn(input.map(normalizeDecodedASN1));\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));\n\t}\n\tif (isASN1String(input)) {\n\t\treturn(normalizeDecodedASN1(input.value));\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);\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),\n\t\t\tvalue: normalizeDecodedASN1(input.value)\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);\n\t\t}\n\t\treturn(result);\n\t}\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"]}
@@ -3,5 +3,5 @@ export type Buffer = InstanceType<typeof KeetaNetLib.Utils.Buffer.Buffer>;
3
3
  export declare const Buffer: typeof KeetaNetLib.Utils.Buffer.Buffer;
4
4
  export declare const bufferToArrayBuffer: typeof KeetaNetLib.Utils.Helper.bufferToArrayBuffer;
5
5
  export declare function arrayBufferToBuffer(arrayBuffer: ArrayBuffer): Buffer;
6
- export declare function arrayBufferLikeToBuffer(buffer: ArrayBufferLike): Buffer;
6
+ export declare function arrayBufferLikeToBuffer(buffer: ArrayBufferLike | ArrayBufferView): Buffer;
7
7
  //# sourceMappingURL=buffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEnE,MAAM,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC1E,eAAO,MAAM,MAAM,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAwC,CAAC;AAM9F,eAAO,MAAM,mBAAmB,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAiG,CAAC;AAgBpK,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAEpE;AAKD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAEvE"}
1
+ {"version":3,"file":"buffer.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEnE,MAAM,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAC1E,eAAO,MAAM,MAAM,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAwC,CAAC;AAM9F,eAAO,MAAM,mBAAmB,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAiG,CAAC;AAkBpK,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAEpE;AAKD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,eAAe,GAAG,eAAe,GAAG,MAAM,CAMzF"}
@@ -8,11 +8,13 @@ export const bufferToArrayBuffer = KeetaNetLib.Utils.Helper.bufferToArrayBuffer.
8
8
  function toBuffer(src) {
9
9
  if (ArrayBuffer.isView(src)) {
10
10
  // Zero-copy: Buffer will reference the same ArrayBuffer range.
11
- return (Buffer.from(src.buffer, src.byteOffset, src.byteLength));
11
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
12
+ return Buffer.from(src.buffer, src.byteOffset, src.byteLength);
12
13
  }
13
14
  // src is ArrayBuffer
14
15
  // Zero-copy: shares memory with the ArrayBuffer
15
- return (Buffer.from(src));
16
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
17
+ return Buffer.from(src);
16
18
  }
17
19
  /*
18
20
  * Helper to convert ArrayBuffer back to Buffer
@@ -24,6 +26,10 @@ export function arrayBufferToBuffer(arrayBuffer) {
24
26
  * Converts a Buffer backed by ArrayBufferLike storage into one backed by an ArrayBuffer.
25
27
  */
26
28
  export function arrayBufferLikeToBuffer(buffer) {
29
+ if (ArrayBuffer.isView(buffer)) {
30
+ return (toBuffer(buffer));
31
+ }
32
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
27
33
  return (toBuffer(buffer));
28
34
  }
29
35
  //# sourceMappingURL=buffer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../../src/lib/utils/buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGnE,MAAM,CAAC,MAAM,MAAM,GAA2C,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;AAE9F;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAwD,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEpK,SAAS,QAAQ,CAAC,GAAkC;IACnD,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,+DAA+D;QAC/D,OAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,qBAAqB;IACrB,gDAAgD;IAChD,OAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAwB;IAC3D,OAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAuB;IAC9D,OAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1B,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\n\nexport type Buffer = InstanceType<typeof KeetaNetLib.Utils.Buffer.Buffer>;\nexport const Buffer: typeof KeetaNetLib.Utils.Buffer.Buffer = KeetaNetLib.Utils.Buffer.Buffer;\n\n/*\n * Because our public interfaces are ArrayBuffers we often need to convert\n * Buffers to ArrayBuffers -- an alias to the Node function to do that\n */\nexport const bufferToArrayBuffer: typeof KeetaNetLib.Utils.Helper.bufferToArrayBuffer = KeetaNetLib.Utils.Helper.bufferToArrayBuffer.bind(KeetaNetLib.Utils.Helper);\n\nfunction toBuffer(src: ArrayBufferView | ArrayBuffer): Buffer {\n\tif (ArrayBuffer.isView(src)) {\n\t\t// Zero-copy: Buffer will reference the same ArrayBuffer range.\n\t\treturn(Buffer.from(src.buffer, src.byteOffset, src.byteLength));\n\t}\n\n\t// src is ArrayBuffer\n\t// Zero-copy: shares memory with the ArrayBuffer\n\treturn(Buffer.from(src));\n}\n\n/*\n * Helper to convert ArrayBuffer back to Buffer\n */\nexport function arrayBufferToBuffer(arrayBuffer: ArrayBuffer): Buffer {\n\treturn(toBuffer(arrayBuffer));\n}\n\n/*\n * Converts a Buffer backed by ArrayBufferLike storage into one backed by an ArrayBuffer.\n */\nexport function arrayBufferLikeToBuffer(buffer: ArrayBufferLike): Buffer {\n\treturn(toBuffer(buffer));\n}\n"]}
1
+ {"version":3,"file":"buffer.js","sourceRoot":"","sources":["../../../src/lib/utils/buffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGnE,MAAM,CAAC,MAAM,MAAM,GAA2C,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;AAE9F;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAwD,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEpK,SAAS,QAAQ,CAAC,GAAkC;IACnD,IAAI,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,+DAA+D;QAC/D,yEAAyE;QACzE,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,UAAU,CAAuB,CAAC;IACtF,CAAC;IAED,qBAAqB;IACrB,gDAAgD;IAChD,yEAAyE;IACzE,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAuB,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAwB;IAC3D,OAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAyC;IAChF,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QAChC,OAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1B,CAAC;IACD,yEAAyE;IACzE,OAAM,CAAC,QAAQ,CAAC,MAAqB,CAAC,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\n\nexport type Buffer = InstanceType<typeof KeetaNetLib.Utils.Buffer.Buffer>;\nexport const Buffer: typeof KeetaNetLib.Utils.Buffer.Buffer = KeetaNetLib.Utils.Buffer.Buffer;\n\n/*\n * Because our public interfaces are ArrayBuffers we often need to convert\n * Buffers to ArrayBuffers -- an alias to the Node function to do that\n */\nexport const bufferToArrayBuffer: typeof KeetaNetLib.Utils.Helper.bufferToArrayBuffer = KeetaNetLib.Utils.Helper.bufferToArrayBuffer.bind(KeetaNetLib.Utils.Helper);\n\nfunction toBuffer(src: ArrayBufferView | ArrayBuffer): Buffer {\n\tif (ArrayBuffer.isView(src)) {\n\t\t// Zero-copy: Buffer will reference the same ArrayBuffer range.\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\treturn(Buffer.from(src.buffer, src.byteOffset, src.byteLength) as unknown as Buffer);\n\t}\n\n\t// src is ArrayBuffer\n\t// Zero-copy: shares memory with the ArrayBuffer\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\treturn(Buffer.from(src) as unknown as Buffer);\n}\n\n/*\n * Helper to convert ArrayBuffer back to Buffer\n */\nexport function arrayBufferToBuffer(arrayBuffer: ArrayBuffer): Buffer {\n\treturn(toBuffer(arrayBuffer));\n}\n\n/*\n * Converts a Buffer backed by ArrayBufferLike storage into one backed by an ArrayBuffer.\n */\nexport function arrayBufferLikeToBuffer(buffer: ArrayBufferLike | ArrayBufferView): Buffer {\n\tif (ArrayBuffer.isView(buffer)) {\n\t\treturn(toBuffer(buffer));\n\t}\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\treturn(toBuffer(buffer as ArrayBuffer));\n}\n"]}
@@ -0,0 +1,43 @@
1
+ import type { Reference } from '../../services/kyc/iso20022.generated.js';
2
+ import type { Buffer } from './buffer.js';
3
+ /**
4
+ * Builder for Reference structures
5
+ *
6
+ * Creates a Reference containing:
7
+ * - ExternalReference: URL and content type
8
+ * - DigestInfo: Hash algorithm OID and digest
9
+ * - Encryption algorithm OID
10
+ */
11
+ export declare class ExternalReferenceBuilder {
12
+ #private;
13
+ /**
14
+ * Create a new ExternalReferenceBuilder
15
+ *
16
+ * @param url - The URL where the document can be accessed
17
+ * @param contentType - MIME type of the document (e.g., 'image/jpeg', 'application/pdf')
18
+ */
19
+ constructor(url: string, contentType: string);
20
+ /**
21
+ * Set the digest algorithm (default: 'sha3-256')
22
+ *
23
+ * @param algorithm - Hash algorithm name (e.g., 'sha256', 'sha3-256')
24
+ * @returns this builder for chaining
25
+ */
26
+ withDigestAlgorithm(algorithm: string): this;
27
+ /**
28
+ * Set the encryption algorithm (default: 'aes-256-gcm')
29
+ *
30
+ * @param algorithm - Encryption algorithm name
31
+ * @returns this builder for chaining
32
+ */
33
+ withEncryptionAlgorithm(algorithm: string): this;
34
+ /**
35
+ * Build the Reference structure
36
+ *
37
+ * @param documentContent - The actual document content to hash
38
+ * @returns The Reference structure
39
+ */
40
+ build(documentContent: Buffer): Reference;
41
+ }
42
+ export default ExternalReferenceBuilder;
43
+ //# sourceMappingURL=external.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/external.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAiC,MAAM,0CAA0C,CAAC;AAEzG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;;;;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;CAwEzC;AAED,eAAe,wBAAwB,CAAC"}
@@ -0,0 +1,115 @@
1
+ // XXX:TODO We need a webpack fallback for crypto in browser environments
2
+ import * as crypto from 'crypto';
3
+ /**
4
+ * Builder for Reference structures
5
+ *
6
+ * Creates a Reference containing:
7
+ * - ExternalReference: URL and content type
8
+ * - DigestInfo: Hash algorithm OID and digest
9
+ * - Encryption algorithm OID
10
+ */
11
+ export class ExternalReferenceBuilder {
12
+ #url;
13
+ #contentType;
14
+ #digestAlgorithm = 'sha3-256';
15
+ #encryptionAlgorithm = 'aes-256-gcm';
16
+ /**
17
+ * Create a new ExternalReferenceBuilder
18
+ *
19
+ * @param url - The URL where the document can be accessed
20
+ * @param contentType - MIME type of the document (e.g., 'image/jpeg', 'application/pdf')
21
+ */
22
+ constructor(url, contentType) {
23
+ this.#url = url;
24
+ this.#contentType = contentType;
25
+ }
26
+ /**
27
+ * Set the digest algorithm (default: 'sha3-256')
28
+ *
29
+ * @param algorithm - Hash algorithm name (e.g., 'sha256', 'sha3-256')
30
+ * @returns this builder for chaining
31
+ */
32
+ withDigestAlgorithm(algorithm) {
33
+ this.#digestAlgorithm = algorithm;
34
+ return (this);
35
+ }
36
+ /**
37
+ * Set the encryption algorithm (default: 'aes-256-gcm')
38
+ *
39
+ * @param algorithm - Encryption algorithm name
40
+ * @returns this builder for chaining
41
+ */
42
+ withEncryptionAlgorithm(algorithm) {
43
+ this.#encryptionAlgorithm = algorithm;
44
+ return (this);
45
+ }
46
+ /**
47
+ * Build the Reference structure
48
+ *
49
+ * @param documentContent - The actual document content to hash
50
+ * @returns The Reference structure
51
+ */
52
+ build(documentContent) {
53
+ // Create the ExternalReference structure
54
+ const externalReference = {
55
+ url: this.#url,
56
+ contentType: this.#contentType
57
+ };
58
+ // Compute the digest of the actual document content
59
+ const hashAlgo = this.#digestAlgorithmToNodeAlgo(this.#digestAlgorithm);
60
+ const hash = crypto.createHash(hashAlgo);
61
+ hash.update(documentContent);
62
+ const digest = hash.digest();
63
+ // Map algorithm names to OIDs
64
+ const digestAlgorithmOID = this.#algorithmToOID(this.#digestAlgorithm);
65
+ const encryptionAlgorithmOID = this.#algorithmToOID(this.#encryptionAlgorithm);
66
+ // Create the RFC 3447 DigestInfo structure
67
+ const digestInfo = {
68
+ digestAlgorithm: digestAlgorithmOID,
69
+ digest: digest
70
+ };
71
+ // Create the Reference structure
72
+ const reference = {
73
+ external: externalReference,
74
+ digest: digestInfo,
75
+ encryptionAlgorithm: encryptionAlgorithmOID
76
+ };
77
+ return (reference);
78
+ }
79
+ /**
80
+ * // XXX:TODO We can handle these better later
81
+ * Map algorithm names to Node.js crypto algorithm names
82
+ */
83
+ #digestAlgorithmToNodeAlgo(algorithm) {
84
+ const algoMap = {
85
+ 'sha256': 'sha256',
86
+ 'sha3-256': 'sha3-256',
87
+ 'sha2-256': 'sha256'
88
+ };
89
+ const nodeAlgo = algoMap[algorithm.toLowerCase()];
90
+ if (!nodeAlgo) {
91
+ throw (new Error(`Unsupported digest algorithm: ${algorithm}`));
92
+ }
93
+ return (nodeAlgo);
94
+ }
95
+ /**
96
+ * // XXX:TODO We can handle these better later
97
+ * Map algorithm names to OIDs
98
+ */
99
+ #algorithmToOID(algorithm) {
100
+ const oidMap = {
101
+ 'sha256': '2.16.840.1.101.3.4.2.1',
102
+ 'sha2-256': '2.16.840.1.101.3.4.2.1',
103
+ 'sha3-256': '2.16.840.1.101.3.4.2.8',
104
+ 'aes-256-cbc': '2.16.840.1.101.3.4.1.42',
105
+ 'aes-256-gcm': '2.16.840.1.101.3.4.1.46'
106
+ };
107
+ const oid = oidMap[algorithm.toLowerCase()];
108
+ if (!oid) {
109
+ throw (new Error(`Unsupported algorithm: ${algorithm}`));
110
+ }
111
+ return ({ type: 'oid', oid });
112
+ }
113
+ }
114
+ export default ExternalReferenceBuilder;
115
+ //# sourceMappingURL=external.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external.js","sourceRoot":"","sources":["../../../src/lib/utils/external.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAKjC;;;;;;;GAOG;AACH,MAAM,OAAO,wBAAwB;IACpC,IAAI,CAAS;IACb,YAAY,CAAS;IACrB,gBAAgB,GAAG,UAAU,CAAC;IAC9B,oBAAoB,GAAG,aAAa,CAAC;IAErC;;;;;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,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAE7B,8BAA8B;QAC9B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CAAC;QACzD,CAAC;QAED,OAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9B,CAAC;CACD;AAED,eAAe,wBAAwB,CAAC","sourcesContent":["// XXX:TODO We need a webpack fallback for crypto in browser environments\nimport * as crypto from 'crypto';\nimport type { Reference, ExternalReference, DigestInfo } from '../../services/kyc/iso20022.generated.js';\nimport type { ASN1OID } from './asn1.js';\nimport type { Buffer } 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 = 'aes-256-gcm';\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: 'aes-256-gcm')\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};\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};\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 default ExternalReferenceBuilder;\n"]}
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@keetanetwork/anchor",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@keetanetwork/anchor",
9
- "version": "0.0.14",
9
+ "version": "0.0.16",
10
10
  "license": "SEE LICENSE IN LICENSE",
11
11
  "dependencies": {
12
12
  "@keetanetwork/currency-info": "1.2.5",
13
- "@keetanetwork/keetanet-client": "0.14.8",
13
+ "@keetanetwork/keetanet-client": "0.14.9",
14
14
  "typia": "9.5.0"
15
15
  },
16
16
  "engines": {
@@ -171,9 +171,9 @@
171
171
  }
172
172
  },
173
173
  "node_modules/@keetanetwork/asn1-napi-rs": {
174
- "version": "1.1.9",
175
- "integrity": "sha512-FLf387OvApX6GgT8JINy7UGfwo86hzlK2sBpQYDPzhLK/mr5tfBi1SJIjlEzt704HyCr/d9O3k5XujD6LwwEdA==",
176
- "license": "Proprietary",
174
+ "version": "1.2.0",
175
+ "integrity": "sha512-gg6IhT8aL4nO/VSPfX6uQXDdBNyB3USRO+RM/Letaz1e6F9kLHJcR7/PrOCXEgcVRK9QtZASw4M2jBE2/6hsgA==",
176
+ "license": "SEE LICENSE IN LICENSE",
177
177
  "optional": true,
178
178
  "engines": {
179
179
  "node": ">= 10"
@@ -185,15 +185,15 @@
185
185
  "license": "ISC"
186
186
  },
187
187
  "node_modules/@keetanetwork/keetanet-client": {
188
- "version": "0.14.8",
189
- "integrity": "sha512-euT801QtPzcCM7XFzj/F9Ldznah3WqoUwU1sBS4JGDm83rlhSnuw2yC9hIMo80pm0CWZjOOeYlMDkjson2EeKQ==",
188
+ "version": "0.14.9",
189
+ "integrity": "sha512-+HI2o47IPSHBh3tlIV5jqMWiKZ4i/QB8tKqlh5Q+OF5DAd7XvPfWXJ475a3Yi9S/wEDXcAo2bawivjsEEwHWLA==",
190
190
  "license": "see LICENSE",
191
191
  "dependencies": {
192
192
  "secp256k1": "5.0.1"
193
193
  },
194
194
  "optionalDependencies": {
195
195
  "@google-cloud/logging": "11.2.0",
196
- "@keetanetwork/asn1-napi-rs": "1.1.9"
196
+ "@keetanetwork/asn1-napi-rs": "1.2.0"
197
197
  }
198
198
  },
199
199
  "node_modules/@opentelemetry/api": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keetanetwork/anchor",
3
- "version": "0.0.14",
3
+ "version": "0.0.16",
4
4
  "description": "KeetaNetwork Network Anchor",
5
5
  "main": "client/index.js",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "sideEffects": false,
24
24
  "dependencies": {
25
25
  "@keetanetwork/currency-info": "1.2.5",
26
- "@keetanetwork/keetanet-client": "0.14.8",
26
+ "@keetanetwork/keetanet-client": "0.14.9",
27
27
  "typia": "9.5.0"
28
28
  },
29
29
  "engines": {