@xyo-network/account-model 6.0.5 → 6.0.6
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/dist/browser/Account.d.ts +3 -2
- package/dist/browser/Account.d.ts.map +1 -1
- package/dist/browser/addressTo20Bytes.d.ts +2 -0
- package/dist/browser/addressTo20Bytes.d.ts.map +1 -0
- package/dist/browser/index.d.ts +1 -1
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.mjs +8 -23
- package/dist/browser/index.mjs.map +3 -3
- package/dist/neutral/Account.d.ts +3 -2
- package/dist/neutral/Account.d.ts.map +1 -1
- package/dist/neutral/addressTo20Bytes.d.ts +2 -0
- package/dist/neutral/addressTo20Bytes.d.ts.map +1 -0
- package/dist/neutral/index.d.ts +1 -1
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +8 -23
- package/dist/neutral/index.mjs.map +3 -3
- package/dist/node/Account.d.ts +3 -2
- package/dist/node/Account.d.ts.map +1 -1
- package/dist/node/addressTo20Bytes.d.ts +2 -0
- package/dist/node/addressTo20Bytes.d.ts.map +1 -0
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.mjs +8 -23
- package/dist/node/index.mjs.map +3 -3
- package/package.json +10 -9
- package/dist/browser/XyoAddress.d.ts +0 -12
- package/dist/browser/XyoAddress.d.ts.map +0 -1
- package/dist/neutral/XyoAddress.d.ts +0 -12
- package/dist/neutral/XyoAddress.d.ts.map +0 -1
- package/dist/node/XyoAddress.d.ts +0 -12
- package/dist/node/XyoAddress.d.ts.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Hash } from '@xylabs/sdk-js';
|
|
2
|
+
import type { XyoAddress } from '@xyo-network/address';
|
|
2
3
|
import type { PrivateKeyInstance, PublicKeyInstance } from '@xyo-network/key-model';
|
|
3
4
|
import type { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
4
5
|
import type { AccountAlgorithm } from './Algorithm.ts';
|
|
@@ -24,7 +25,7 @@ export declare const isPrivateKeyInitializationConfig: (value: unknown) => value
|
|
|
24
25
|
export declare const isMnemonicInitializationConfig: (value: unknown) => value is MnemonicInitializationConfig;
|
|
25
26
|
export declare const isInitializationConfig: (value: unknown) => value is InitializationConfig;
|
|
26
27
|
export interface AccountInstance {
|
|
27
|
-
readonly address:
|
|
28
|
+
readonly address: XyoAddress;
|
|
28
29
|
readonly addressBytes: ArrayBufferLike;
|
|
29
30
|
readonly algorithm: AccountAlgorithm;
|
|
30
31
|
previousHash: Hash | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../src/Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../src/Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAE/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnE,eAAO,MAAM,gBAAgB,qCAAqC,CAAA;AAElE,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAA;CACf;AACD,MAAM,WAAW,8BAA8B;IAC7C,UAAU,EAAE,eAAe,CAAA;CAC5B;AACD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAA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,SAAS,OAAO,KAAG,OAAO,IAAI,eAG/D,CAAA;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EAAE,CAAC,SAAS,aAAa,GAAG,aAAa;IACjH,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IAC/B,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAChF,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC,CAAA;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addressTo20Bytes.d.ts","sourceRoot":"","sources":["../../src/addressTo20Bytes.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAEjE"}
|
package/dist/browser/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -27,6 +27,9 @@ var isAccountInstance = (account) => {
|
|
|
27
27
|
return typeof account.address === "string";
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
// src/addressTo20Bytes.ts
|
|
31
|
+
import { toUint8Array } from "@xylabs/sdk-js";
|
|
32
|
+
|
|
30
33
|
// src/Algorithm.ts
|
|
31
34
|
var AccountAlgorithmPrefix = {
|
|
32
35
|
"secp256k1": null,
|
|
@@ -48,6 +51,11 @@ function prefixForAlgorithm(algorithm) {
|
|
|
48
51
|
return prefix === null ? "" : `${prefix}_`;
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
// src/addressTo20Bytes.ts
|
|
55
|
+
function addressTo20Bytes(address) {
|
|
56
|
+
return toUint8Array(stripAddressPrefix(address), 20).buffer;
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
// src/Jwt/constants.ts
|
|
52
60
|
import { Enum } from "@xylabs/sdk-js";
|
|
53
61
|
var JwtAlg = Enum({ ES256K: "ES256K" });
|
|
@@ -70,35 +78,13 @@ async function verifySignature(address, hash, signature) {
|
|
|
70
78
|
}
|
|
71
79
|
return await fn(address, hash, signature);
|
|
72
80
|
}
|
|
73
|
-
|
|
74
|
-
// src/XyoAddress.ts
|
|
75
|
-
import {
|
|
76
|
-
AddressZod,
|
|
77
|
-
asAddress,
|
|
78
|
-
isAddress,
|
|
79
|
-
toUint8Array
|
|
80
|
-
} from "@xylabs/sdk-js";
|
|
81
|
-
var XyoAddressRegEx = /^(?:qr1_)?[0-9a-f]{40}$/;
|
|
82
|
-
var XyoAddressZod = AddressZod;
|
|
83
|
-
function isXyoAddress(value) {
|
|
84
|
-
return isAddress(value);
|
|
85
|
-
}
|
|
86
|
-
function asXyoAddress(value) {
|
|
87
|
-
return asAddress(value);
|
|
88
|
-
}
|
|
89
|
-
function addressTo20Bytes(address) {
|
|
90
|
-
return toUint8Array(stripAddressPrefix(address), 20).buffer;
|
|
91
|
-
}
|
|
92
81
|
export {
|
|
93
82
|
AccountAlgorithmPrefix,
|
|
94
83
|
JwtAlg,
|
|
95
84
|
JwtSchema,
|
|
96
85
|
JwtTyp,
|
|
97
|
-
XyoAddressRegEx,
|
|
98
|
-
XyoAddressZod,
|
|
99
86
|
addressTo20Bytes,
|
|
100
87
|
algorithmFromAddress,
|
|
101
|
-
asXyoAddress,
|
|
102
88
|
ethMessagePrefix,
|
|
103
89
|
getVerifier,
|
|
104
90
|
isAccountInstance,
|
|
@@ -106,7 +92,6 @@ export {
|
|
|
106
92
|
isMnemonicInitializationConfig,
|
|
107
93
|
isPhraseInitializationConfig,
|
|
108
94
|
isPrivateKeyInitializationConfig,
|
|
109
|
-
isXyoAddress,
|
|
110
95
|
prefixForAlgorithm,
|
|
111
96
|
registerVerifier,
|
|
112
97
|
stripAddressPrefix,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Account.ts", "../../src/
|
|
4
|
-
"sourcesContent": ["import type {
|
|
5
|
-
"mappings": ";AACA,SAAS,qBAAqB;
|
|
3
|
+
"sources": ["../../src/Account.ts", "../../src/addressTo20Bytes.ts", "../../src/Algorithm.ts", "../../src/Jwt/constants.ts", "../../src/VerifierRegistry.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Hash } from '@xylabs/sdk-js'\nimport { isArrayBuffer } from '@xylabs/sdk-js'\nimport type { XyoAddress } from '@xyo-network/address'\nimport type { PrivateKeyInstance, PublicKeyInstance } from '@xyo-network/key-model'\nimport type { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\n\nimport type { AccountAlgorithm } from './Algorithm.ts'\nimport type { SignJwtOptions, SignJwtResult } from './Jwt/types.ts'\n\nexport const ethMessagePrefix = '\\u0019Ethereum Signed Message:\\n'\n\nexport interface PhraseInitializationConfig {\n phrase: string\n}\nexport interface PrivateKeyInitializationConfig {\n privateKey: ArrayBufferLike\n}\nexport interface MnemonicInitializationConfig {\n mnemonic: string\n path?: string\n}\nexport interface AccountOptions {\n previousHash?: ArrayBufferLike\n}\n\nexport type InitializationConfig = PhraseInitializationConfig | PrivateKeyInitializationConfig | MnemonicInitializationConfig\n\nexport type AccountConfig = InitializationConfig & AccountOptions\n\nexport const isPhraseInitializationConfig = (value: unknown): value is PhraseInitializationConfig => {\n if (typeof value === 'object' && value !== null) {\n return typeof (value as PhraseInitializationConfig).phrase === 'string'\n }\n return false\n}\n\nexport const isPrivateKeyInitializationConfig = (value: unknown): value is PrivateKeyInitializationConfig => {\n if (typeof value === 'object' && value !== null) {\n return isArrayBuffer((value as PrivateKeyInitializationConfig).privateKey)\n }\n return false\n}\n\nexport const isMnemonicInitializationConfig = (value: unknown): value is MnemonicInitializationConfig => {\n if (typeof value === 'object' && value !== null) {\n return (\n typeof (value as MnemonicInitializationConfig).mnemonic === 'string' && typeof ((value as MnemonicInitializationConfig).path ?? '') === 'string'\n )\n }\n return false\n}\n\nexport const isInitializationConfig = (value: unknown): value is InitializationConfig => {\n return isPhraseInitializationConfig(value) || isPrivateKeyInitializationConfig(value) || isMnemonicInitializationConfig(value)\n}\n\nexport interface AccountInstance {\n readonly address: XyoAddress\n readonly addressBytes: ArrayBufferLike\n readonly algorithm: AccountAlgorithm\n previousHash: Hash | undefined\n previousHashBytes: ArrayBufferLike | undefined\n readonly private?: PrivateKeyInstance\n readonly public?: PublicKeyInstance\n sign: (hash: ArrayBufferLike, previousHash?: ArrayBufferLike) => Promise<[ArrayBufferLike, Hash?]>\n signJwt: (options: SignJwtOptions) => Promise<SignJwtResult>\n verify: (msg: ArrayBufferLike, signature: ArrayBufferLike) => Promise<boolean>\n}\n\nexport const isAccountInstance = (account: unknown): account is AccountInstance => {\n if (typeof account !== 'object' || account === null) return false\n return typeof (account as { address?: unknown }).address === 'string'\n}\n\nexport interface AccountStatic<T extends AccountInstance = AccountInstance, C extends AccountConfig = AccountConfig> {\n previousHashStore?: PreviousHashStore\n create(options?: C): Promise<T>\n fromPrivateKey(key: ArrayBufferLike | bigint | string): Promise<AccountInstance>\n random(): Promise<AccountInstance>\n}\n", "import { toUint8Array } from '@xylabs/sdk-js'\n\nimport { stripAddressPrefix } from './Algorithm.ts'\n\nexport function addressTo20Bytes(address: string): ArrayBufferLike {\n return toUint8Array(stripAddressPrefix(address), 20).buffer\n}\n", "export type AccountAlgorithm = 'secp256k1' | 'ml-dsa-65'\n\nexport const AccountAlgorithmPrefix = {\n 'secp256k1': null,\n 'ml-dsa-65': 'qr1',\n} as const satisfies Record<AccountAlgorithm, string | null>\n\nexport function algorithmFromAddress(address: string): AccountAlgorithm {\n const underscore = address.indexOf('_')\n // secp256k1 addresses are unprefixed bare 40-hex strings\n if (underscore === -1) return 'secp256k1'\n const prefix = address.slice(0, underscore)\n if (prefix === AccountAlgorithmPrefix['ml-dsa-65']) return 'ml-dsa-65'\n throw new Error(`Unknown address algorithm prefix [${prefix}]`)\n}\n\nexport function stripAddressPrefix(address: string): string {\n const underscore = address.indexOf('_')\n return underscore === -1 ? address : address.slice(underscore + 1)\n}\n\nexport function prefixForAlgorithm(algorithm: AccountAlgorithm): string {\n const prefix = AccountAlgorithmPrefix[algorithm]\n return prefix === null ? '' : `${prefix}_`\n}\n", "import { Enum } from '@xylabs/sdk-js'\n\nexport const JwtAlg = Enum({ ES256K: 'ES256K' } as const)\nexport type JwtAlg = Enum<typeof JwtAlg>\n\nexport const JwtTyp = Enum({ JWT: 'JWT' } as const)\nexport type JwtTyp = Enum<typeof JwtTyp>\n\nexport const JwtSchema = Enum({ Signin: 'network.xyo.auth.signin' } as const)\nexport type JwtSchema = Enum<typeof JwtSchema>\n", "import type { AccountAlgorithm } from './Algorithm.ts'\nimport { algorithmFromAddress } from './Algorithm.ts'\n\nexport type VerifySignatureFn = (address: string, hash: ArrayBufferLike, signature: ArrayBufferLike) => Promise<boolean>\n\nconst registry: Partial<Record<AccountAlgorithm, VerifySignatureFn>> = {}\n\nexport function registerVerifier(algorithm: AccountAlgorithm, fn: VerifySignatureFn): void {\n registry[algorithm] = fn\n}\n\nexport function getVerifier(algorithm: AccountAlgorithm): VerifySignatureFn | undefined {\n return registry[algorithm]\n}\n\nexport async function verifySignature(address: string, hash: ArrayBufferLike, signature: ArrayBufferLike): Promise<boolean> {\n const algorithm = algorithmFromAddress(address)\n const fn = registry[algorithm]\n if (!fn) {\n throw new Error(`No verifier registered for algorithm [${algorithm}]. Did you import the account package?`)\n }\n return await fn(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AmB,WAAqC;AACtE,QAAM,SAAS,uBAAuB,SAAS;AAC/C,SAAO,WAAW,OAAO,KAAK,GAAG,MAAM;AACzC;;;ADpBO,SAAS,iBAAiB,SAAkC;AACjE,SAAO,aAAa,mBAAmB,OAAO,GAAG,EAAE,EAAE;AACvD;;;AENA,SAAS,YAAY;AAEd,IAAM,SAAS,KAAK,EAAE,QAAQ,SAAS,CAAU;AAGjD,IAAM,SAAS,KAAK,EAAE,KAAK,MAAM,CAAU;AAG3C,IAAM,YAAY,KAAK,EAAE,QAAQ,0BAA0B,CAAU;;;ACH5E,IAAM,WAAiE,CAAC;AAEjE,SAAS,iBAAiB,WAA6B,IAA6B;AACzF,WAAS,SAAS,IAAI;AACxB;AAEO,SAAS,YAAY,WAA4D;AACtF,SAAO,SAAS,SAAS;AAC3B;AAEA,eAAsB,gBAAgB,SAAiB,MAAuB,WAA8C;AAC1H,QAAM,YAAY,qBAAqB,OAAO;AAC9C,QAAM,KAAK,SAAS,SAAS;AAC7B,MAAI,CAAC,IAAI;AACP,UAAM,IAAI,MAAM,yCAAyC,SAAS,wCAAwC;AAAA,EAC5G;AACA,SAAO,MAAM,GAAG,SAAS,MAAM,SAAS;AAC1C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Hash } from '@xylabs/sdk-js';
|
|
2
|
+
import type { XyoAddress } from '@xyo-network/address';
|
|
2
3
|
import type { PrivateKeyInstance, PublicKeyInstance } from '@xyo-network/key-model';
|
|
3
4
|
import type { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
4
5
|
import type { AccountAlgorithm } from './Algorithm.ts';
|
|
@@ -24,7 +25,7 @@ export declare const isPrivateKeyInitializationConfig: (value: unknown) => value
|
|
|
24
25
|
export declare const isMnemonicInitializationConfig: (value: unknown) => value is MnemonicInitializationConfig;
|
|
25
26
|
export declare const isInitializationConfig: (value: unknown) => value is InitializationConfig;
|
|
26
27
|
export interface AccountInstance {
|
|
27
|
-
readonly address:
|
|
28
|
+
readonly address: XyoAddress;
|
|
28
29
|
readonly addressBytes: ArrayBufferLike;
|
|
29
30
|
readonly algorithm: AccountAlgorithm;
|
|
30
31
|
previousHash: Hash | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../src/Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../src/Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAE/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnE,eAAO,MAAM,gBAAgB,qCAAqC,CAAA;AAElE,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAA;CACf;AACD,MAAM,WAAW,8BAA8B;IAC7C,UAAU,EAAE,eAAe,CAAA;CAC5B;AACD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AACD,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,eAAe,CAAA;CAC/B;AAED,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,GAAG,8BAA8B,GAAG,4BAA4B,CAAA;AAE7H,MAAM,MAAM,aAAa,GAAG,oBAAoB,GAAG,cAAc,CAAA;AAEjE,eAAO,M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,CAAC,CAAC,CAAC,CAAA;IAC/B,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAChF,MAAM,IAAI,OAAO,CAAC,eAAe,CAAC,CAAA;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addressTo20Bytes.d.ts","sourceRoot":"","sources":["../../src/addressTo20Bytes.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAEjE"}
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -27,6 +27,9 @@ var isAccountInstance = (account) => {
|
|
|
27
27
|
return typeof account.address === "string";
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
// src/addressTo20Bytes.ts
|
|
31
|
+
import { toUint8Array } from "@xylabs/sdk-js";
|
|
32
|
+
|
|
30
33
|
// src/Algorithm.ts
|
|
31
34
|
var AccountAlgorithmPrefix = {
|
|
32
35
|
"secp256k1": null,
|
|
@@ -48,6 +51,11 @@ function prefixForAlgorithm(algorithm) {
|
|
|
48
51
|
return prefix === null ? "" : `${prefix}_`;
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
// src/addressTo20Bytes.ts
|
|
55
|
+
function addressTo20Bytes(address) {
|
|
56
|
+
return toUint8Array(stripAddressPrefix(address), 20).buffer;
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
// src/Jwt/constants.ts
|
|
52
60
|
import { Enum } from "@xylabs/sdk-js";
|
|
53
61
|
var JwtAlg = Enum({ ES256K: "ES256K" });
|
|
@@ -70,35 +78,13 @@ async function verifySignature(address, hash, signature) {
|
|
|
70
78
|
}
|
|
71
79
|
return await fn(address, hash, signature);
|
|
72
80
|
}
|
|
73
|
-
|
|
74
|
-
// src/XyoAddress.ts
|
|
75
|
-
import {
|
|
76
|
-
AddressZod,
|
|
77
|
-
asAddress,
|
|
78
|
-
isAddress,
|
|
79
|
-
toUint8Array
|
|
80
|
-
} from "@xylabs/sdk-js";
|
|
81
|
-
var XyoAddressRegEx = /^(?:qr1_)?[0-9a-f]{40}$/;
|
|
82
|
-
var XyoAddressZod = AddressZod;
|
|
83
|
-
function isXyoAddress(value) {
|
|
84
|
-
return isAddress(value);
|
|
85
|
-
}
|
|
86
|
-
function asXyoAddress(value) {
|
|
87
|
-
return asAddress(value);
|
|
88
|
-
}
|
|
89
|
-
function addressTo20Bytes(address) {
|
|
90
|
-
return toUint8Array(stripAddressPrefix(address), 20).buffer;
|
|
91
|
-
}
|
|
92
81
|
export {
|
|
93
82
|
AccountAlgorithmPrefix,
|
|
94
83
|
JwtAlg,
|
|
95
84
|
JwtSchema,
|
|
96
85
|
JwtTyp,
|
|
97
|
-
XyoAddressRegEx,
|
|
98
|
-
XyoAddressZod,
|
|
99
86
|
addressTo20Bytes,
|
|
100
87
|
algorithmFromAddress,
|
|
101
|
-
asXyoAddress,
|
|
102
88
|
ethMessagePrefix,
|
|
103
89
|
getVerifier,
|
|
104
90
|
isAccountInstance,
|
|
@@ -106,7 +92,6 @@ export {
|
|
|
106
92
|
isMnemonicInitializationConfig,
|
|
107
93
|
isPhraseInitializationConfig,
|
|
108
94
|
isPrivateKeyInitializationConfig,
|
|
109
|
-
isXyoAddress,
|
|
110
95
|
prefixForAlgorithm,
|
|
111
96
|
registerVerifier,
|
|
112
97
|
stripAddressPrefix,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Account.ts", "../../src/
|
|
4
|
-
"sourcesContent": ["import type {
|
|
5
|
-
"mappings": ";AACA,SAAS,qBAAqB;
|
|
3
|
+
"sources": ["../../src/Account.ts", "../../src/addressTo20Bytes.ts", "../../src/Algorithm.ts", "../../src/Jwt/constants.ts", "../../src/VerifierRegistry.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Hash } from '@xylabs/sdk-js'\nimport { isArrayBuffer } from '@xylabs/sdk-js'\nimport type { XyoAddress } from '@xyo-network/address'\nimport type { PrivateKeyInstance, PublicKeyInstance } from '@xyo-network/key-model'\nimport type { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\n\nimport type { AccountAlgorithm } from './Algorithm.ts'\nimport type { SignJwtOptions, SignJwtResult } from './Jwt/types.ts'\n\nexport const ethMessagePrefix = '\\u0019Ethereum Signed Message:\\n'\n\nexport interface PhraseInitializationConfig {\n phrase: string\n}\nexport interface PrivateKeyInitializationConfig {\n privateKey: ArrayBufferLike\n}\nexport interface MnemonicInitializationConfig {\n mnemonic: string\n path?: string\n}\nexport interface AccountOptions {\n previousHash?: ArrayBufferLike\n}\n\nexport type InitializationConfig = PhraseInitializationConfig | PrivateKeyInitializationConfig | MnemonicInitializationConfig\n\nexport type AccountConfig = InitializationConfig & AccountOptions\n\nexport const isPhraseInitializationConfig = (value: unknown): value is PhraseInitializationConfig => {\n if (typeof value === 'object' && value !== null) {\n return typeof (value as PhraseInitializationConfig).phrase === 'string'\n }\n return false\n}\n\nexport const isPrivateKeyInitializationConfig = (value: unknown): value is PrivateKeyInitializationConfig => {\n if (typeof value === 'object' && value !== null) {\n return isArrayBuffer((value as PrivateKeyInitializationConfig).privateKey)\n }\n return false\n}\n\nexport const isMnemonicInitializationConfig = (value: unknown): value is MnemonicInitializationConfig => {\n if (typeof value === 'object' && value !== null) {\n return (\n typeof (value as MnemonicInitializationConfig).mnemonic === 'string' && typeof ((value as MnemonicInitializationConfig).path ?? '') === 'string'\n )\n }\n return false\n}\n\nexport const isInitializationConfig = (value: unknown): value is InitializationConfig => {\n return isPhraseInitializationConfig(value) || isPrivateKeyInitializationConfig(value) || isMnemonicInitializationConfig(value)\n}\n\nexport interface AccountInstance {\n readonly address: XyoAddress\n readonly addressBytes: ArrayBufferLike\n readonly algorithm: AccountAlgorithm\n previousHash: Hash | undefined\n previousHashBytes: ArrayBufferLike | undefined\n readonly private?: PrivateKeyInstance\n readonly public?: PublicKeyInstance\n sign: (hash: ArrayBufferLike, previousHash?: ArrayBufferLike) => Promise<[ArrayBufferLike, Hash?]>\n signJwt: (options: SignJwtOptions) => Promise<SignJwtResult>\n verify: (msg: ArrayBufferLike, signature: ArrayBufferLike) => Promise<boolean>\n}\n\nexport const isAccountInstance = (account: unknown): account is AccountInstance => {\n if (typeof account !== 'object' || account === null) return false\n return typeof (account as { address?: unknown }).address === 'string'\n}\n\nexport interface AccountStatic<T extends AccountInstance = AccountInstance, C extends AccountConfig = AccountConfig> {\n previousHashStore?: PreviousHashStore\n create(options?: C): Promise<T>\n fromPrivateKey(key: ArrayBufferLike | bigint | string): Promise<AccountInstance>\n random(): Promise<AccountInstance>\n}\n", "import { toUint8Array } from '@xylabs/sdk-js'\n\nimport { stripAddressPrefix } from './Algorithm.ts'\n\nexport function addressTo20Bytes(address: string): ArrayBufferLike {\n return toUint8Array(stripAddressPrefix(address), 20).buffer\n}\n", "export type AccountAlgorithm = 'secp256k1' | 'ml-dsa-65'\n\nexport const AccountAlgorithmPrefix = {\n 'secp256k1': null,\n 'ml-dsa-65': 'qr1',\n} as const satisfies Record<AccountAlgorithm, string | null>\n\nexport function algorithmFromAddress(address: string): AccountAlgorithm {\n const underscore = address.indexOf('_')\n // secp256k1 addresses are unprefixed bare 40-hex strings\n if (underscore === -1) return 'secp256k1'\n const prefix = address.slice(0, underscore)\n if (prefix === AccountAlgorithmPrefix['ml-dsa-65']) return 'ml-dsa-65'\n throw new Error(`Unknown address algorithm prefix [${prefix}]`)\n}\n\nexport function stripAddressPrefix(address: string): string {\n const underscore = address.indexOf('_')\n return underscore === -1 ? address : address.slice(underscore + 1)\n}\n\nexport function prefixForAlgorithm(algorithm: AccountAlgorithm): string {\n const prefix = AccountAlgorithmPrefix[algorithm]\n return prefix === null ? '' : `${prefix}_`\n}\n", "import { Enum } from '@xylabs/sdk-js'\n\nexport const JwtAlg = Enum({ ES256K: 'ES256K' } as const)\nexport type JwtAlg = Enum<typeof JwtAlg>\n\nexport const JwtTyp = Enum({ JWT: 'JWT' } as const)\nexport type JwtTyp = Enum<typeof JwtTyp>\n\nexport const JwtSchema = Enum({ Signin: 'network.xyo.auth.signin' } as const)\nexport type JwtSchema = Enum<typeof JwtSchema>\n", "import type { AccountAlgorithm } from './Algorithm.ts'\nimport { algorithmFromAddress } from './Algorithm.ts'\n\nexport type VerifySignatureFn = (address: string, hash: ArrayBufferLike, signature: ArrayBufferLike) => Promise<boolean>\n\nconst registry: Partial<Record<AccountAlgorithm, VerifySignatureFn>> = {}\n\nexport function registerVerifier(algorithm: AccountAlgorithm, fn: VerifySignatureFn): void {\n registry[algorithm] = fn\n}\n\nexport function getVerifier(algorithm: AccountAlgorithm): VerifySignatureFn | undefined {\n return registry[algorithm]\n}\n\nexport async function verifySignature(address: string, hash: ArrayBufferLike, signature: ArrayBufferLike): Promise<boolean> {\n const algorithm = algorithmFromAddress(address)\n const fn = registry[algorithm]\n if (!fn) {\n throw new Error(`No verifier registered for algorithm [${algorithm}]. Did you import the account package?`)\n }\n return await fn(address, hash, signature)\n}\n"],
|
|
5
|
+
"mappings": ";AACA,SAAS,qBAAqB;AAQvB,IAAM,mBAAmB;AAoBzB,IAAM,+BAA+B,CAAC,UAAwD;AACnG,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO,OAAQ,MAAqC,WAAW;AAAA,EACjE;AACA,SAAO;AACT;AAEO,IAAM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QAAQ,SAAS,CAAU;AAGjD,IAAM,SAAS,KAAK,EAAE,KAAK,MAAM,CAAU;AAG3C,IAAM,YAAY,KAAK,EAAE,QAAQ,0BAA0B,CAAU;;;ACH5E,IAAM,WAAiE,CAAC;AAEjE,SAAS,iBAAiB,WAA6B,IAA6B;AACzF,WAAS,SAAS,IAAI;AACxB;AAEO,SAAS,YAAY,WAA4D;AACtF,SAAO,SAAS,SAAS;AAC3B;AAEA,eAAsB,gBAAgB,SAAiB,MAAuB,WAA8C;AAC1H,QAAM,YAAY,qBAAqB,OAAO;AAC9C,QAAM,KAAK,SAAS,SAAS;AAC7B,MAAI,CAAC,IAAI;AACP,UAAM,IAAI,MAAM,yCAAyC,SAAS,wCAAwC;AAAA,EAC5G;AACA,SAAO,MAAM,GAAG,SAAS,MAAM,SAAS;AAC1C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/node/Account.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Hash } from '@xylabs/sdk-js';
|
|
2
|
+
import type { XyoAddress } from '@xyo-network/address';
|
|
2
3
|
import type { PrivateKeyInstance, PublicKeyInstance } from '@xyo-network/key-model';
|
|
3
4
|
import type { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
4
5
|
import type { AccountAlgorithm } from './Algorithm.ts';
|
|
@@ -24,7 +25,7 @@ export declare const isPrivateKeyInitializationConfig: (value: unknown) => value
|
|
|
24
25
|
export declare const isMnemonicInitializationConfig: (value: unknown) => value is MnemonicInitializationConfig;
|
|
25
26
|
export declare const isInitializationConfig: (value: unknown) => value is InitializationConfig;
|
|
26
27
|
export interface AccountInstance {
|
|
27
|
-
readonly address:
|
|
28
|
+
readonly address: XyoAddress;
|
|
28
29
|
readonly addressBytes: ArrayBufferLike;
|
|
29
30
|
readonly algorithm: AccountAlgorithm;
|
|
30
31
|
previousHash: Hash | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../src/Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../src/Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAE/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnE,eAAO,MAAM,gBAAgB,qCAAqC,CAAA;AAElE,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAA;CACf;AACD,MAAM,WAAW,8BAA8B;IAC7C,UAAU,EAAE,eAAe,CAAA;CAC5B;AACD,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AACD,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,eAAe,CAAA;CAC/B;AAED,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,GAAG,8BAA8B,GAAG,4BAA4B,CAAA;AAE7H,MAAM,MAAM,aAAa,GAAG,oBAAoB,GAAG,cAAc,CAAA;AAEjE,eAAO,MAAM,4BAA4B,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,0BAKtE,CAAA;AAED,eAAO,MAAM,gCAAgC,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,8BAK1E,CAAA;AAED,eAAO,MAAM,8BAA8B,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,4BAO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|
1
|
+
{"version":3,"file":"addressTo20Bytes.d.ts","sourceRoot":"","sources":["../../src/addressTo20Bytes.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAEjE"}
|
package/dist/node/index.d.ts
CHANGED
package/dist/node/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,uBAAuB,CAAA"}
|
package/dist/node/index.mjs
CHANGED
|
@@ -27,6 +27,9 @@ var isAccountInstance = (account) => {
|
|
|
27
27
|
return typeof account.address === "string";
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
// src/addressTo20Bytes.ts
|
|
31
|
+
import { toUint8Array } from "@xylabs/sdk-js";
|
|
32
|
+
|
|
30
33
|
// src/Algorithm.ts
|
|
31
34
|
var AccountAlgorithmPrefix = {
|
|
32
35
|
"secp256k1": null,
|
|
@@ -48,6 +51,11 @@ function prefixForAlgorithm(algorithm) {
|
|
|
48
51
|
return prefix === null ? "" : `${prefix}_`;
|
|
49
52
|
}
|
|
50
53
|
|
|
54
|
+
// src/addressTo20Bytes.ts
|
|
55
|
+
function addressTo20Bytes(address) {
|
|
56
|
+
return toUint8Array(stripAddressPrefix(address), 20).buffer;
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
// src/Jwt/constants.ts
|
|
52
60
|
import { Enum } from "@xylabs/sdk-js";
|
|
53
61
|
var JwtAlg = Enum({ ES256K: "ES256K" });
|
|
@@ -70,35 +78,13 @@ async function verifySignature(address, hash, signature) {
|
|
|
70
78
|
}
|
|
71
79
|
return await fn(address, hash, signature);
|
|
72
80
|
}
|
|
73
|
-
|
|
74
|
-
// src/XyoAddress.ts
|
|
75
|
-
import {
|
|
76
|
-
AddressZod,
|
|
77
|
-
asAddress,
|
|
78
|
-
isAddress,
|
|
79
|
-
toUint8Array
|
|
80
|
-
} from "@xylabs/sdk-js";
|
|
81
|
-
var XyoAddressRegEx = /^(?:qr1_)?[0-9a-f]{40}$/;
|
|
82
|
-
var XyoAddressZod = AddressZod;
|
|
83
|
-
function isXyoAddress(value) {
|
|
84
|
-
return isAddress(value);
|
|
85
|
-
}
|
|
86
|
-
function asXyoAddress(value) {
|
|
87
|
-
return asAddress(value);
|
|
88
|
-
}
|
|
89
|
-
function addressTo20Bytes(address) {
|
|
90
|
-
return toUint8Array(stripAddressPrefix(address), 20).buffer;
|
|
91
|
-
}
|
|
92
81
|
export {
|
|
93
82
|
AccountAlgorithmPrefix,
|
|
94
83
|
JwtAlg,
|
|
95
84
|
JwtSchema,
|
|
96
85
|
JwtTyp,
|
|
97
|
-
XyoAddressRegEx,
|
|
98
|
-
XyoAddressZod,
|
|
99
86
|
addressTo20Bytes,
|
|
100
87
|
algorithmFromAddress,
|
|
101
|
-
asXyoAddress,
|
|
102
88
|
ethMessagePrefix,
|
|
103
89
|
getVerifier,
|
|
104
90
|
isAccountInstance,
|
|
@@ -106,7 +92,6 @@ export {
|
|
|
106
92
|
isMnemonicInitializationConfig,
|
|
107
93
|
isPhraseInitializationConfig,
|
|
108
94
|
isPrivateKeyInitializationConfig,
|
|
109
|
-
isXyoAddress,
|
|
110
95
|
prefixForAlgorithm,
|
|
111
96
|
registerVerifier,
|
|
112
97
|
stripAddressPrefix,
|
package/dist/node/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Account.ts", "../../src/
|
|
4
|
-
"sourcesContent": ["import type {
|
|
5
|
-
"mappings": ";AACA,SAAS,qBAAqB;
|
|
3
|
+
"sources": ["../../src/Account.ts", "../../src/addressTo20Bytes.ts", "../../src/Algorithm.ts", "../../src/Jwt/constants.ts", "../../src/VerifierRegistry.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Hash } from '@xylabs/sdk-js'\nimport { isArrayBuffer } from '@xylabs/sdk-js'\nimport type { XyoAddress } from '@xyo-network/address'\nimport type { PrivateKeyInstance, PublicKeyInstance } from '@xyo-network/key-model'\nimport type { PreviousHashStore } from '@xyo-network/previous-hash-store-model'\n\nimport type { AccountAlgorithm } from './Algorithm.ts'\nimport type { SignJwtOptions, SignJwtResult } from './Jwt/types.ts'\n\nexport const ethMessagePrefix = '\\u0019Ethereum Signed Message:\\n'\n\nexport interface PhraseInitializationConfig {\n phrase: string\n}\nexport interface PrivateKeyInitializationConfig {\n privateKey: ArrayBufferLike\n}\nexport interface MnemonicInitializationConfig {\n mnemonic: string\n path?: string\n}\nexport interface AccountOptions {\n previousHash?: ArrayBufferLike\n}\n\nexport type InitializationConfig = PhraseInitializationConfig | PrivateKeyInitializationConfig | MnemonicInitializationConfig\n\nexport type AccountConfig = InitializationConfig & AccountOptions\n\nexport const isPhraseInitializationConfig = (value: unknown): value is PhraseInitializationConfig => {\n if (typeof value === 'object' && value !== null) {\n return typeof (value as PhraseInitializationConfig).phrase === 'string'\n }\n return false\n}\n\nexport const isPrivateKeyInitializationConfig = (value: unknown): value is PrivateKeyInitializationConfig => {\n if (typeof value === 'object' && value !== null) {\n return isArrayBuffer((value as PrivateKeyInitializationConfig).privateKey)\n }\n return false\n}\n\nexport const isMnemonicInitializationConfig = (value: unknown): value is MnemonicInitializationConfig => {\n if (typeof value === 'object' && value !== null) {\n return (\n typeof (value as MnemonicInitializationConfig).mnemonic === 'string' && typeof ((value as MnemonicInitializationConfig).path ?? '') === 'string'\n )\n }\n return false\n}\n\nexport const isInitializationConfig = (value: unknown): value is InitializationConfig => {\n return isPhraseInitializationConfig(value) || isPrivateKeyInitializationConfig(value) || isMnemonicInitializationConfig(value)\n}\n\nexport interface AccountInstance {\n readonly address: XyoAddress\n readonly addressBytes: ArrayBufferLike\n readonly algorithm: AccountAlgorithm\n previousHash: Hash | undefined\n previousHashBytes: ArrayBufferLike | undefined\n readonly private?: PrivateKeyInstance\n readonly public?: PublicKeyInstance\n sign: (hash: ArrayBufferLike, previousHash?: ArrayBufferLike) => Promise<[ArrayBufferLike, Hash?]>\n signJwt: (options: SignJwtOptions) => Promise<SignJwtResult>\n verify: (msg: ArrayBufferLike, signature: ArrayBufferLike) => Promise<boolean>\n}\n\nexport const isAccountInstance = (account: unknown): account is AccountInstance => {\n if (typeof account !== 'object' || account === null) return false\n return typeof (account as { address?: unknown }).address === 'string'\n}\n\nexport interface AccountStatic<T extends AccountInstance = AccountInstance, C extends AccountConfig = AccountConfig> {\n previousHashStore?: PreviousHashStore\n create(options?: C): Promise<T>\n fromPrivateKey(key: ArrayBufferLike | bigint | string): Promise<AccountInstance>\n random(): Promise<AccountInstance>\n}\n", "import { toUint8Array } from '@xylabs/sdk-js'\n\nimport { stripAddressPrefix } from './Algorithm.ts'\n\nexport function addressTo20Bytes(address: string): ArrayBufferLike {\n return toUint8Array(stripAddressPrefix(address), 20).buffer\n}\n", "export type AccountAlgorithm = 'secp256k1' | 'ml-dsa-65'\n\nexport const AccountAlgorithmPrefix = {\n 'secp256k1': null,\n 'ml-dsa-65': 'qr1',\n} as const satisfies Record<AccountAlgorithm, string | null>\n\nexport function algorithmFromAddress(address: string): AccountAlgorithm {\n const underscore = address.indexOf('_')\n // secp256k1 addresses are unprefixed bare 40-hex strings\n if (underscore === -1) return 'secp256k1'\n const prefix = address.slice(0, underscore)\n if (prefix === AccountAlgorithmPrefix['ml-dsa-65']) return 'ml-dsa-65'\n throw new Error(`Unknown address algorithm prefix [${prefix}]`)\n}\n\nexport function stripAddressPrefix(address: string): string {\n const underscore = address.indexOf('_')\n return underscore === -1 ? address : address.slice(underscore + 1)\n}\n\nexport function prefixForAlgorithm(algorithm: AccountAlgorithm): string {\n const prefix = AccountAlgorithmPrefix[algorithm]\n return prefix === null ? '' : `${prefix}_`\n}\n", "import { Enum } from '@xylabs/sdk-js'\n\nexport const JwtAlg = Enum({ ES256K: 'ES256K' } as const)\nexport type JwtAlg = Enum<typeof JwtAlg>\n\nexport const JwtTyp = Enum({ JWT: 'JWT' } as const)\nexport type JwtTyp = Enum<typeof JwtTyp>\n\nexport const JwtSchema = Enum({ Signin: 'network.xyo.auth.signin' } as const)\nexport type JwtSchema = Enum<typeof JwtSchema>\n", "import type { AccountAlgorithm } from './Algorithm.ts'\nimport { algorithmFromAddress } from './Algorithm.ts'\n\nexport type VerifySignatureFn = (address: string, hash: ArrayBufferLike, signature: ArrayBufferLike) => Promise<boolean>\n\nconst registry: Partial<Record<AccountAlgorithm, VerifySignatureFn>> = {}\n\nexport function registerVerifier(algorithm: AccountAlgorithm, fn: VerifySignatureFn): void {\n registry[algorithm] = fn\n}\n\nexport function getVerifier(algorithm: AccountAlgorithm): VerifySignatureFn | undefined {\n return registry[algorithm]\n}\n\nexport async function verifySignature(address: string, hash: ArrayBufferLike, signature: ArrayBufferLike): Promise<boolean> {\n const algorithm = algorithmFromAddress(address)\n const fn = registry[algorithm]\n if (!fn) {\n throw new Error(`No verifier registered for algorithm [${algorithm}]. Did you import the account package?`)\n }\n return await fn(address, hash, signature)\n}\n"],
|
|
5
|
+
"mappings": ";AACA,SAAS,qBAAqB;AAQvB,IAAM,mBAAmB;AAoBzB,IAAM,+BAA+B,CAAC,UAAwD;AACnG,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO,OAAQ,MAAqC,WAAW;AAAA,EACjE;AACA,SAAO;AACT;AAEO,IAAM,mCAAmC,CAAC,UAA4D;AAC3G,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,WAAO,cAAe,MAAyC,UAAU;AAAA,EAC3E;AACA,SAAO;AACT;AAEO,IAAM,iCAAiC,CAAC,UAA0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AAS,iBAAiB,WAA6B,IAA6B;AACzF,WAAS,SAAS,IAAI;AACxB;AAEO,SAAS,YAAY,WAA4D;AACtF,SAAO,SAAS,SAAS;AAC3B;AAEA,eAAsB,gBAAgB,SAAiB,MAAuB,WAA8C;AAC1H,QAAM,YAAY,qBAAqB,OAAO;AAC9C,QAAM,KAAK,SAAS,SAAS;AAC7B,MAAI,CAAC,IAAI;AACP,UAAM,IAAI,MAAM,yCAAyC,SAAS,wCAAwC;AAAA,EAC5G;AACA,SAAO,MAAM,GAAG,SAAS,MAAM,SAAS;AAC1C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/account-model",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.6",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -34,22 +34,23 @@
|
|
|
34
34
|
"README.md"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@xyo-network/
|
|
38
|
-
"@xyo-network/
|
|
37
|
+
"@xyo-network/key-model": "~6.0.6",
|
|
38
|
+
"@xyo-network/address": "~6.0.6",
|
|
39
|
+
"@xyo-network/previous-hash-store-model": "~6.0.6"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@opentelemetry/api": "^1.9.1",
|
|
42
43
|
"@opentelemetry/sdk-trace-base": "^2.7.1",
|
|
43
44
|
"@scure/base": "~2.2.0",
|
|
44
|
-
"@xylabs/sdk-js": "~6.0.
|
|
45
|
-
"@xylabs/toolchain": "~8.1.
|
|
46
|
-
"@xylabs/tsconfig": "~8.1.
|
|
45
|
+
"@xylabs/sdk-js": "~6.0.6",
|
|
46
|
+
"@xylabs/toolchain": "~8.1.8",
|
|
47
|
+
"@xylabs/tsconfig": "~8.1.8",
|
|
47
48
|
"async-mutex": "^0.5.0",
|
|
48
49
|
"bn.js": "^5.2.3",
|
|
49
50
|
"buffer": "^6.0.3",
|
|
50
|
-
"eslint": "^10.4.
|
|
51
|
+
"eslint": "^10.4.1",
|
|
51
52
|
"ethers": "^6.16.0",
|
|
52
|
-
"pako": "
|
|
53
|
+
"pako": "^2.1",
|
|
53
54
|
"typescript": "~6.0.3",
|
|
54
55
|
"zod": "^4.4.3"
|
|
55
56
|
},
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
"bn.js": "^5.2",
|
|
63
64
|
"buffer": "^6.0",
|
|
64
65
|
"ethers": "^6.16",
|
|
65
|
-
"pako": "
|
|
66
|
+
"pako": "^2.1",
|
|
66
67
|
"zod": "^4.4"
|
|
67
68
|
},
|
|
68
69
|
"engines": {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type * as z from 'zod/mini';
|
|
2
|
-
export declare const XyoAddressRegEx: RegExp;
|
|
3
|
-
export declare const XyoAddressZod: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<Lowercase<string> & {
|
|
4
|
-
readonly __hex: true;
|
|
5
|
-
} & {
|
|
6
|
-
readonly __address: true;
|
|
7
|
-
}, string>>;
|
|
8
|
-
export type XyoAddress = z.infer<typeof XyoAddressZod>;
|
|
9
|
-
export declare function isXyoAddress(value: unknown): value is XyoAddress;
|
|
10
|
-
export declare function asXyoAddress(value: unknown): XyoAddress | undefined;
|
|
11
|
-
export declare function addressTo20Bytes(address: string): ArrayBufferLike;
|
|
12
|
-
//# sourceMappingURL=XyoAddress.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XyoAddress.d.ts","sourceRoot":"","sources":["../../src/XyoAddress.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,CAAC,MAAM,UAAU,CAAA;AAIlC,eAAO,MAAM,eAAe,QAA4B,CAAA;AAExD,eAAO,MAAM,aAAa;;;;WAAa,CAAA;AAEvC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAEnE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAEjE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type * as z from 'zod/mini';
|
|
2
|
-
export declare const XyoAddressRegEx: RegExp;
|
|
3
|
-
export declare const XyoAddressZod: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<Lowercase<string> & {
|
|
4
|
-
readonly __hex: true;
|
|
5
|
-
} & {
|
|
6
|
-
readonly __address: true;
|
|
7
|
-
}, string>>;
|
|
8
|
-
export type XyoAddress = z.infer<typeof XyoAddressZod>;
|
|
9
|
-
export declare function isXyoAddress(value: unknown): value is XyoAddress;
|
|
10
|
-
export declare function asXyoAddress(value: unknown): XyoAddress | undefined;
|
|
11
|
-
export declare function addressTo20Bytes(address: string): ArrayBufferLike;
|
|
12
|
-
//# sourceMappingURL=XyoAddress.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XyoAddress.d.ts","sourceRoot":"","sources":["../../src/XyoAddress.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,CAAC,MAAM,UAAU,CAAA;AAIlC,eAAO,MAAM,eAAe,QAA4B,CAAA;AAExD,eAAO,MAAM,aAAa;;;;WAAa,CAAA;AAEvC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAEnE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAEjE"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type * as z from 'zod/mini';
|
|
2
|
-
export declare const XyoAddressRegEx: RegExp;
|
|
3
|
-
export declare const XyoAddressZod: z.ZodMiniPipe<z.ZodMiniString<string>, z.ZodMiniTransform<Lowercase<string> & {
|
|
4
|
-
readonly __hex: true;
|
|
5
|
-
} & {
|
|
6
|
-
readonly __address: true;
|
|
7
|
-
}, string>>;
|
|
8
|
-
export type XyoAddress = z.infer<typeof XyoAddressZod>;
|
|
9
|
-
export declare function isXyoAddress(value: unknown): value is XyoAddress;
|
|
10
|
-
export declare function asXyoAddress(value: unknown): XyoAddress | undefined;
|
|
11
|
-
export declare function addressTo20Bytes(address: string): ArrayBufferLike;
|
|
12
|
-
//# sourceMappingURL=XyoAddress.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"XyoAddress.d.ts","sourceRoot":"","sources":["../../src/XyoAddress.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,CAAC,MAAM,UAAU,CAAA;AAIlC,eAAO,MAAM,eAAe,QAA4B,CAAA;AAExD,eAAO,MAAM,aAAa;;;;WAAa,CAAA;AAEvC,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AAEtD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAEnE;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAEjE"}
|