@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.
- package/lib/certificates.d.ts.map +1 -1
- package/lib/certificates.js +20 -100
- package/lib/certificates.js.map +1 -1
- package/lib/http-server.js +1 -1
- package/lib/http-server.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/log/index.d.ts +6 -57
- package/lib/log/index.d.ts.map +1 -1
- package/lib/log/index.js +5 -205
- package/lib/log/index.js.map +1 -1
- package/lib/log/target_console.d.ts +3 -11
- package/lib/log/target_console.d.ts.map +1 -1
- package/lib/log/target_console.js +3 -42
- package/lib/log/target_console.js.map +1 -1
- package/lib/resolver.js +22 -22
- package/lib/uri.d.ts +28 -0
- package/lib/uri.d.ts.map +1 -0
- package/lib/uri.js +100 -0
- package/lib/uri.js.map +1 -0
- package/lib/utils/asn1.d.ts +9 -1
- package/lib/utils/asn1.d.ts.map +1 -1
- package/lib/utils/asn1.js +1413 -0
- package/lib/utils/asn1.js.map +1 -1
- package/lib/utils/buffer.d.ts +1 -1
- package/lib/utils/buffer.d.ts.map +1 -1
- package/lib/utils/buffer.js +8 -2
- package/lib/utils/buffer.js.map +1 -1
- package/lib/utils/external.d.ts +43 -0
- package/lib/utils/external.d.ts.map +1 -0
- package/lib/utils/external.js +115 -0
- package/lib/utils/external.js.map +1 -0
- package/npm-shrinkwrap.json +9 -9
- package/package.json +2 -2
- package/services/asset-movement/common.js +7 -7
- package/services/kyc/iso20022.generated.d.ts +89 -28
- package/services/kyc/iso20022.generated.d.ts.map +1 -1
- package/services/kyc/iso20022.generated.js +191 -88
- package/services/kyc/iso20022.generated.js.map +1 -1
- package/services/kyc/oids.generated.d.ts +24 -9
- package/services/kyc/oids.generated.d.ts.map +1 -1
- package/services/kyc/oids.generated.js +38 -15
- package/services/kyc/oids.generated.js.map +1 -1
- package/services/kyc/utils/generate-kyc-schema.js +305 -75
- package/services/kyc/utils/generate-kyc-schema.js.map +1 -1
- package/lib/log/common.d.ts +0 -35
- package/lib/log/common.d.ts.map +0 -1
- package/lib/log/common.js +0 -19
- package/lib/log/common.js.map +0 -1
package/lib/uri.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { GenericAccount, TokenAddress } from "@keetanetwork/keetanet-client/lib/account.js";
|
|
2
|
+
declare const URLProtocol: "keeta:";
|
|
3
|
+
export type KeetaURIString = `${typeof URLProtocol}//${string}`;
|
|
4
|
+
/**
|
|
5
|
+
* The actions that can be represented in a Keeta URI, currently only "send"
|
|
6
|
+
*/
|
|
7
|
+
export type KeetaURIActions = {
|
|
8
|
+
type: 'send';
|
|
9
|
+
to?: GenericAccount;
|
|
10
|
+
token?: TokenAddress;
|
|
11
|
+
value?: bigint;
|
|
12
|
+
external?: string[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Parse a Keeta URI string into a KeetaURIActions object
|
|
16
|
+
* @param uri The string to parse, must be a valid Keeta URI
|
|
17
|
+
* @returns The parsed Keeta URI action
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseKeetaURI(uri: string): KeetaURIActions;
|
|
20
|
+
/**
|
|
21
|
+
* Encode a KeetaURIActions object into a Keeta URI string
|
|
22
|
+
* @param action The action to encode into a Keeta URI
|
|
23
|
+
* @returns The encoded Keeta URI string
|
|
24
|
+
*/
|
|
25
|
+
export declare function encodeKeetaURI(action: KeetaURIActions): KeetaURIString;
|
|
26
|
+
export declare function assertKeetaURIString(value: unknown): KeetaURIString;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=uri.d.ts.map
|
package/lib/uri.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uri.d.ts","sourceRoot":"","sources":["../../src/lib/uri.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,8CAA8C,CAAC;AAKjG,QAAA,MAAM,WAAW,UAAoB,CAAC;AACtC,MAAM,MAAM,cAAc,GAAG,GAAG,OAAO,WAAW,KAAK,MAAM,EAAE,CAAC;AAGhE;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IAGb,EAAE,CAAC,EAAE,cAAc,CAAC;IAGpB,KAAK,CAAC,EAAE,YAAY,CAAC;IAGrB,KAAK,CAAC,EAAE,MAAM,CAAC;IAIf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAA;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAwD1D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,cAAc,CA0BtE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CAcnE"}
|
package/lib/uri.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';
|
|
2
|
+
import { KeetaAnchorUserError } from "./error.js";
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
4
|
+
const URLProtocol = 'keeta:';
|
|
5
|
+
/**
|
|
6
|
+
* Parse a Keeta URI string into a KeetaURIActions object
|
|
7
|
+
* @param uri The string to parse, must be a valid Keeta URI
|
|
8
|
+
* @returns The parsed Keeta URI action
|
|
9
|
+
*/
|
|
10
|
+
export function parseKeetaURI(uri) {
|
|
11
|
+
const url = new URL(uri);
|
|
12
|
+
if (url.protocol !== URLProtocol) {
|
|
13
|
+
throw (new KeetaAnchorUserError(`Invalid protocol: ${url.protocol}`));
|
|
14
|
+
}
|
|
15
|
+
if (url.hostname !== 'actions') {
|
|
16
|
+
throw (new KeetaAnchorUserError(`Invalid hostname: ${url.hostname}, expected actions`));
|
|
17
|
+
}
|
|
18
|
+
const path = url.pathname.slice(1); // Remove leading '/'
|
|
19
|
+
const pathParts = path.split('/');
|
|
20
|
+
const action = pathParts.shift();
|
|
21
|
+
if (!action) {
|
|
22
|
+
throw (new KeetaAnchorUserError('No action specified in URI'));
|
|
23
|
+
}
|
|
24
|
+
if (action === 'send') {
|
|
25
|
+
if (pathParts.length !== 0) {
|
|
26
|
+
throw (new KeetaAnchorUserError(`Unexpected path parts: ${pathParts.join('/')}`));
|
|
27
|
+
}
|
|
28
|
+
const ret = {
|
|
29
|
+
type: 'send'
|
|
30
|
+
};
|
|
31
|
+
const toParam = url.searchParams.get('to');
|
|
32
|
+
if (toParam) {
|
|
33
|
+
ret.to = KeetaNetLib.Account.fromPublicKeyString(toParam);
|
|
34
|
+
}
|
|
35
|
+
const tokenParam = url.searchParams.get('token');
|
|
36
|
+
if (tokenParam) {
|
|
37
|
+
ret.token = KeetaNetLib.Account.fromPublicKeyString(tokenParam).assertKeyType(KeetaNetLib.Account.AccountKeyAlgorithm.TOKEN);
|
|
38
|
+
}
|
|
39
|
+
const valueParam = url.searchParams.get('value');
|
|
40
|
+
if (valueParam !== null) {
|
|
41
|
+
try {
|
|
42
|
+
ret.value = BigInt(valueParam);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
throw (new KeetaAnchorUserError(`Invalid value: ${valueParam}`));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const externalParams = url.searchParams.getAll('external');
|
|
49
|
+
if (externalParams.length > 0) {
|
|
50
|
+
ret.external = externalParams;
|
|
51
|
+
}
|
|
52
|
+
return (ret);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
throw (new KeetaAnchorUserError(`Invalid action: ${action}`));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Encode a KeetaURIActions object into a Keeta URI string
|
|
60
|
+
* @param action The action to encode into a Keeta URI
|
|
61
|
+
* @returns The encoded Keeta URI string
|
|
62
|
+
*/
|
|
63
|
+
export function encodeKeetaURI(action) {
|
|
64
|
+
const url = new URL(`${URLProtocol}//actions`);
|
|
65
|
+
if (action.type === 'send') {
|
|
66
|
+
url.pathname = '/send';
|
|
67
|
+
if (action.to !== undefined) {
|
|
68
|
+
url.searchParams.set('to', action.to.publicKeyString.get());
|
|
69
|
+
}
|
|
70
|
+
if (action.token !== undefined) {
|
|
71
|
+
url.searchParams.set('token', action.token.publicKeyString.get());
|
|
72
|
+
}
|
|
73
|
+
if (action.value !== undefined) {
|
|
74
|
+
url.searchParams.set('value', String(action.value));
|
|
75
|
+
}
|
|
76
|
+
for (const ext of (action.external ?? [])) {
|
|
77
|
+
url.searchParams.append('external', ext);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw (new KeetaAnchorUserError(`Invalid action type provided`));
|
|
82
|
+
}
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
84
|
+
return url.toString();
|
|
85
|
+
}
|
|
86
|
+
export function assertKeetaURIString(value) {
|
|
87
|
+
if (typeof value !== 'string') {
|
|
88
|
+
throw (new KeetaAnchorUserError('KeetaURIString must be a string'));
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
parseKeetaURI(value);
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
95
|
+
throw (new KeetaAnchorUserError(`Invalid KeetaURIString: ${e.message}`));
|
|
96
|
+
}
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
98
|
+
return value;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=uri.js.map
|
package/lib/uri.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uri.js","sourceRoot":"","sources":["../../src/lib/uri.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+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IAAI,oBAAoB,CAAC,2BAA4B,CAAW,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACpF,CAAC;IAED,yEAAyE;IACzE,OAAO,KAAwB,CAAC;AACjC,CAAC","sourcesContent":["import type { GenericAccount, TokenAddress } from \"@keetanetwork/keetanet-client/lib/account.js\";\nimport { lib as KeetaNetLib } from '@keetanetwork/keetanet-client';\nimport { KeetaAnchorUserError } from \"./error.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\nconst URLProtocol = 'keeta:' as const;\nexport type KeetaURIString = `${typeof URLProtocol}//${string}`;\n\n\n/**\n * The actions that can be represented in a Keeta URI, currently only \"send\"\n */\nexport type KeetaURIActions = {\n\ttype: 'send';\n\n\t// Optional \"to\" parameter representing the recipient account of the action\n\tto?: GenericAccount;\n\n\t// Optional \"token\" parameter representing the token address of the action\n\ttoken?: TokenAddress;\n\n\t// Optional \"value\" parameter representing the amount to send\n\tvalue?: bigint;\n\n\t// Optional \"external\" parameter representing external data\n\t// When used the first item should be the external field of the SEND operation, and other fields can be used for chaining anchor actions\n\texternal?: string[];\n}\n\n/**\n * Parse a Keeta URI string into a KeetaURIActions object\n * @param uri The string to parse, must be a valid Keeta URI\n * @returns The parsed Keeta URI action\n */\nexport function parseKeetaURI(uri: string): KeetaURIActions {\n\tconst url = new URL(uri);\n\n\tif (url.protocol !== URLProtocol) {\n\t\tthrow(new KeetaAnchorUserError(`Invalid protocol: ${url.protocol}`));\n\t}\n\n\tif (url.hostname !== 'actions') {\n\t\tthrow(new KeetaAnchorUserError(`Invalid hostname: ${url.hostname}, expected actions`));\n\t}\n\n\tconst path = url.pathname.slice(1); // Remove leading '/'\n\tconst pathParts = path.split('/');\n\tconst action = pathParts.shift();\n\n\tif (!action) {\n\t\tthrow(new KeetaAnchorUserError('No action specified in URI'));\n\t}\n\n\tif (action === 'send') {\n\t\tif (pathParts.length !== 0) {\n\t\t\tthrow(new KeetaAnchorUserError(`Unexpected path parts: ${pathParts.join('/')}`));\n\t\t}\n\n\t\tconst ret: Extract<KeetaURIActions, { type: 'send' }> = {\n\t\t\ttype: 'send'\n\t\t};\n\n\t\tconst toParam = url.searchParams.get('to');\n\t\tif (toParam) {\n\t\t\tret.to = KeetaNetLib.Account.fromPublicKeyString(toParam);\n\t\t}\n\n\t\tconst tokenParam = url.searchParams.get('token');\n\t\tif (tokenParam) {\n\t\t\tret.token = KeetaNetLib.Account.fromPublicKeyString(tokenParam).assertKeyType(KeetaNetLib.Account.AccountKeyAlgorithm.TOKEN);\n\t\t}\n\n\t\tconst valueParam = url.searchParams.get('value');\n\t\tif (valueParam !== null) {\n\t\t\ttry {\n\t\t\t\tret.value = BigInt(valueParam);\n\t\t\t} catch {\n\t\t\t\tthrow(new KeetaAnchorUserError(`Invalid value: ${valueParam}`));\n\t\t\t}\n\t\t}\n\n\t\tconst externalParams = url.searchParams.getAll('external');\n\t\tif (externalParams.length > 0) {\n\t\t\tret.external = externalParams;\n\t\t}\n\n\t\treturn(ret);\n\t} else {\n\t\tthrow(new KeetaAnchorUserError(`Invalid action: ${action}`));\n\t}\n}\n\n/**\n * Encode a KeetaURIActions object into a Keeta URI string\n * @param action The action to encode into a Keeta URI\n * @returns\tThe encoded Keeta URI string\n */\nexport function encodeKeetaURI(action: KeetaURIActions): KeetaURIString {\n\tconst url = new URL(`${URLProtocol}//actions`);\n\tif (action.type === 'send') {\n\t\turl.pathname = '/send';\n\n\t\tif (action.to !== undefined) {\n\t\t\turl.searchParams.set('to', action.to.publicKeyString.get());\n\t\t}\n\n\t\tif (action.token !== undefined) {\n\t\t\turl.searchParams.set('token', action.token.publicKeyString.get());\n\t\t}\n\n\t\tif (action.value !== undefined) {\n\t\t\turl.searchParams.set('value', String(action.value));\n\t\t}\n\n\t\tfor (const ext of (action.external ?? [])) {\n\t\t\turl.searchParams.append('external', ext);\n\t\t}\n\t} else {\n\t\tthrow(new KeetaAnchorUserError(`Invalid action type provided`));\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\treturn(url.toString() as KeetaURIString);\n}\n\nexport function assertKeetaURIString(value: unknown): KeetaURIString {\n\tif (typeof value !== 'string') {\n\t\tthrow(new KeetaAnchorUserError('KeetaURIString must be a string'));\n\t}\n\n\ttry {\n\t\tparseKeetaURI(value);\n\t} catch (e) {\n\t\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\t\tthrow(new KeetaAnchorUserError(`Invalid KeetaURIString: ${(e as Error).message}`));\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n\treturn(value as KeetaURIString);\n}\n"]}
|
package/lib/utils/asn1.d.ts
CHANGED
|
@@ -6,9 +6,17 @@ declare const JStoASN1: typeof ASN1.JStoASN1;
|
|
|
6
6
|
declare const BufferStorageASN1: typeof ASN1.BufferStorageASN1;
|
|
7
7
|
declare const ValidateASN1: typeof ASN1.ValidateASN1;
|
|
8
8
|
type ASN1AnyJS = ASN1Types.ASN1AnyJS;
|
|
9
|
+
type ASN1OID = ASN1Types.ASN1OID;
|
|
9
10
|
type ASN1ContextTag = ASN1Types.ASN1ContextTag;
|
|
10
11
|
type Schema = ASN1Types.ValidateASN1.Schema;
|
|
11
12
|
type SchemaMap<T extends Schema> = ASN1Types.ValidateASN1.SchemaMap<T>;
|
|
12
|
-
|
|
13
|
+
type EncodeOptions = {
|
|
14
|
+
attributeName?: string;
|
|
15
|
+
valuePrinter?: (value: unknown) => string;
|
|
16
|
+
};
|
|
17
|
+
export declare function contextualizeStructSchema(schema: Schema): Schema;
|
|
18
|
+
export declare function encodeValueBySchema(schema: Schema, value: unknown, options?: EncodeOptions): ASN1AnyJS;
|
|
19
|
+
export declare function normalizeDecodedASN1(input: unknown): unknown;
|
|
20
|
+
export type { ASN1AnyJS, ASN1OID, ASN1ContextTag, Schema, SchemaMap };
|
|
13
21
|
export { ASN1toJS, JStoASN1, BufferStorageASN1, ValidateASN1 };
|
|
14
22
|
//# sourceMappingURL=asn1.d.ts.map
|
package/lib/utils/asn1.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asn1.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/asn1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,KAAK,SAAS,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"asn1.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/asn1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,KAAK,SAAS,MAAM,iDAAiD,CAAC;AAWlF,QAAA,MAAM,IAAI,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC,IAA6B,CAAC;AAEnE,QAAA,MAAM,QAAQ,EAAE,OAAO,IAAI,CAAC,QAAwB,CAAC;AACrD,QAAA,MAAM,QAAQ,EAAE,OAAO,IAAI,CAAC,QAAwB,CAAC;AACrD,QAAA,MAAM,iBAAiB,EAAE,OAAO,IAAI,CAAC,iBAA0C,CAAC;AAChF,QAAA,MAAM,YAAY,EAAE,OAAO,IAAI,CAAC,YAAgC,CAAC;AAKjE,KAAK,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC;AACrC,KAAK,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;AACjC,KAAK,cAAc,GAAG,SAAS,CAAC,cAAc,CAAC;AAC/C,KAAK,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC;AAC5C,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,IAAI,SAAS,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAMvE,KAAK,aAAa,GAAG;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;CAC1C,CAAC;AAwCF,wBA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