@xyo-network/account-model 7.0.4 → 7.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/README.md +1 -47
- package/dist/neutral/index.d.ts +5 -5
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +2 -99
- package/dist/neutral/index.mjs.map +4 -4
- package/package.json +19 -15
- package/dist/neutral/Account.d.ts +0 -46
- package/dist/neutral/Account.d.ts.map +0 -1
- package/dist/neutral/Algorithm.d.ts +0 -5
- package/dist/neutral/Algorithm.d.ts.map +0 -1
- package/dist/neutral/Jwt/constants.d.ts +0 -14
- package/dist/neutral/Jwt/constants.d.ts.map +0 -1
- package/dist/neutral/Jwt/index.d.ts +0 -3
- package/dist/neutral/Jwt/index.d.ts.map +0 -1
- package/dist/neutral/Jwt/types.d.ts +0 -56
- package/dist/neutral/Jwt/types.d.ts.map +0 -1
- package/dist/neutral/VerifierRegistry.d.ts +0 -6
- package/dist/neutral/VerifierRegistry.d.ts.map +0 -1
- package/dist/neutral/addressTo20Bytes.d.ts +0 -2
- package/dist/neutral/addressTo20Bytes.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,49 +1,3 @@
|
|
|
1
|
-
[![logo][]](https://xyo.network)
|
|
2
|
-
|
|
3
1
|
# @xyo-network/account-model
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
[![license][license-badge]][license-link]
|
|
7
|
-
|
|
8
|
-
> Primary SDK for using XYO Protocol 2.0
|
|
9
|
-
|
|
10
|
-
## Install
|
|
11
|
-
|
|
12
|
-
Using npm:
|
|
13
|
-
|
|
14
|
-
```sh
|
|
15
|
-
npm install {{name}}
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Using yarn:
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
yarn add {{name}}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Using pnpm:
|
|
25
|
-
|
|
26
|
-
```sh
|
|
27
|
-
pnpm add {{name}}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Using bun:
|
|
31
|
-
|
|
32
|
-
```sh
|
|
33
|
-
bun add {{name}}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
## License
|
|
38
|
-
|
|
39
|
-
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
40
|
-
|
|
41
|
-
## Credits
|
|
42
|
-
|
|
43
|
-
[Made with 🔥 and ❄️ by XYO Foundation](https://xyo.network)
|
|
44
|
-
|
|
45
|
-
[npm-badge]: https://img.shields.io/npm/v/@xyo-network/account-model.svg
|
|
46
|
-
[npm-link]: https://www.npmjs.com/package/@xyo-network/account-model
|
|
47
|
-
[license-badge]: https://img.shields.io/npm/l/@xyo-network/account-model.svg
|
|
48
|
-
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
|
|
49
|
-
[logo]: https://cdn.xy.company/img/brand/XYO_full_colored.png
|
|
3
|
+
Deprecated compatibility stub. Use `@xyo-network/sdk-protocol/account-model` instead.
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export * from '
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use `@xyo-network/sdk-protocol/account-model` instead.
|
|
3
|
+
* `@xyo-network/account-model` is a backward-compatibility re-export stub.
|
|
4
|
+
*/
|
|
5
|
+
export * from '@xyo-network/sdk-protocol/account-model';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,yCAAyC,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,100 +1,3 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
3
|
-
var ethMessagePrefix = "Ethereum Signed Message:\n";
|
|
4
|
-
var isPhraseInitializationConfig = (value) => {
|
|
5
|
-
if (typeof value === "object" && value !== null) {
|
|
6
|
-
return typeof value.phrase === "string";
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
9
|
-
};
|
|
10
|
-
var isPrivateKeyInitializationConfig = (value) => {
|
|
11
|
-
if (typeof value === "object" && value !== null) {
|
|
12
|
-
return isArrayBuffer(value.privateKey);
|
|
13
|
-
}
|
|
14
|
-
return false;
|
|
15
|
-
};
|
|
16
|
-
var isMnemonicInitializationConfig = (value) => {
|
|
17
|
-
if (typeof value === "object" && value !== null) {
|
|
18
|
-
return typeof value.mnemonic === "string" && typeof (value.path ?? "") === "string";
|
|
19
|
-
}
|
|
20
|
-
return false;
|
|
21
|
-
};
|
|
22
|
-
var isInitializationConfig = (value) => {
|
|
23
|
-
return isPhraseInitializationConfig(value) || isPrivateKeyInitializationConfig(value) || isMnemonicInitializationConfig(value);
|
|
24
|
-
};
|
|
25
|
-
var isAccountInstance = (account) => {
|
|
26
|
-
if (typeof account !== "object" || account === null) return false;
|
|
27
|
-
return typeof account.address === "string";
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// src/addressTo20Bytes.ts
|
|
31
|
-
import { toUint8Array } from "@xylabs/sdk";
|
|
32
|
-
import { tryDecodeQuantAddress } from "@xyo-network/address";
|
|
33
|
-
function addressTo20Bytes(address) {
|
|
34
|
-
const decoded = tryDecodeQuantAddress(address);
|
|
35
|
-
return (decoded === void 0 ? toUint8Array(address, 20) : decoded.bytes).buffer;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// src/Algorithm.ts
|
|
39
|
-
import { tryDecodeQuantAddress as tryDecodeQuantAddress2 } from "@xyo-network/address";
|
|
40
|
-
var AlgorithmHrpEntries = [
|
|
41
|
-
["ml-dsa-65", "qm65"]
|
|
42
|
-
];
|
|
43
|
-
var AccountAlgorithmHrp = Object.fromEntries(AlgorithmHrpEntries);
|
|
44
|
-
var HrpToAlgorithm = Object.fromEntries(
|
|
45
|
-
AlgorithmHrpEntries.map(([algorithm, hrp]) => [hrp, algorithm])
|
|
46
|
-
);
|
|
47
|
-
function hrpForAlgorithm(algorithm) {
|
|
48
|
-
return AccountAlgorithmHrp[algorithm];
|
|
49
|
-
}
|
|
50
|
-
function algorithmFromAddress(address) {
|
|
51
|
-
const decoded = tryDecodeQuantAddress2(address);
|
|
52
|
-
if (decoded === void 0) return "secp256k1";
|
|
53
|
-
const algorithm = HrpToAlgorithm[decoded.hrp];
|
|
54
|
-
if (algorithm === void 0) {
|
|
55
|
-
throw new Error(`Unknown address algorithm HRP [${decoded.hrp}]`);
|
|
56
|
-
}
|
|
57
|
-
return algorithm;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// src/Jwt/constants.ts
|
|
61
|
-
import { Enum } from "@xylabs/sdk";
|
|
62
|
-
var JwtAlg = Enum({ ES256K: "ES256K" });
|
|
63
|
-
var JwtTyp = Enum({ JWT: "JWT" });
|
|
64
|
-
var JwtSchema = Enum({ Signin: "network.xyo.auth.signin" });
|
|
65
|
-
|
|
66
|
-
// src/VerifierRegistry.ts
|
|
67
|
-
var registry = {};
|
|
68
|
-
function registerVerifier(algorithm, fn) {
|
|
69
|
-
registry[algorithm] = fn;
|
|
70
|
-
}
|
|
71
|
-
function getVerifier(algorithm) {
|
|
72
|
-
return registry[algorithm];
|
|
73
|
-
}
|
|
74
|
-
async function verifySignature(address, hash, signature) {
|
|
75
|
-
const algorithm = algorithmFromAddress(address);
|
|
76
|
-
const fn = registry[algorithm];
|
|
77
|
-
if (!fn) {
|
|
78
|
-
throw new Error(`No verifier registered for algorithm [${algorithm}]. Did you import the account package?`);
|
|
79
|
-
}
|
|
80
|
-
return await fn(address, hash, signature);
|
|
81
|
-
}
|
|
82
|
-
export {
|
|
83
|
-
AccountAlgorithmHrp,
|
|
84
|
-
JwtAlg,
|
|
85
|
-
JwtSchema,
|
|
86
|
-
JwtTyp,
|
|
87
|
-
addressTo20Bytes,
|
|
88
|
-
algorithmFromAddress,
|
|
89
|
-
ethMessagePrefix,
|
|
90
|
-
getVerifier,
|
|
91
|
-
hrpForAlgorithm,
|
|
92
|
-
isAccountInstance,
|
|
93
|
-
isInitializationConfig,
|
|
94
|
-
isMnemonicInitializationConfig,
|
|
95
|
-
isPhraseInitializationConfig,
|
|
96
|
-
isPrivateKeyInitializationConfig,
|
|
97
|
-
registerVerifier,
|
|
98
|
-
verifySignature
|
|
99
|
-
};
|
|
1
|
+
// src/index.ts
|
|
2
|
+
export * from "@xyo-network/sdk-protocol/account-model";
|
|
100
3
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": [
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @deprecated Use `@xyo-network/sdk-protocol/account-model` instead.\n * `@xyo-network/account-model` is a backward-compatibility re-export stub.\n */\nexport * from '@xyo-network/sdk-protocol/account-model'\n"],
|
|
5
|
+
"mappings": ";AAIA,cAAc;",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/account-model",
|
|
3
|
-
"version": "7.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.0.6",
|
|
4
|
+
"description": "DEPRECATED - use @xyo-network/sdk-protocol/account-model. Backward-compatibility re-export stub for @xyo-network/account-model.",
|
|
5
|
+
"deprecated": "Use @xyo-network/sdk-protocol/account-model instead. @xyo-network/account-model is a backward-compatibility re-export stub and will not receive further updates.",
|
|
5
6
|
"homepage": "https://xyo.network",
|
|
6
7
|
"bugs": {
|
|
7
8
|
"url": "git+https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues",
|
|
@@ -34,30 +35,33 @@
|
|
|
34
35
|
"README.md"
|
|
35
36
|
],
|
|
36
37
|
"dependencies": {
|
|
37
|
-
"@xyo-network/
|
|
38
|
-
"@xyo-network/key-model": "~7.0.4",
|
|
39
|
-
"@xyo-network/previous-hash-store-model": "~7.0.4"
|
|
38
|
+
"@xyo-network/sdk-protocol": "~7.0.6"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@scure/base": "~2.2.0",
|
|
45
|
-
"@xylabs/sdk": "^7.0.1",
|
|
46
|
-
"@xylabs/toolchain": "~8.5.3",
|
|
47
|
-
"@xylabs/tsconfig": "~8.5.3",
|
|
48
|
-
"async-mutex": "^0.5.0",
|
|
41
|
+
"@xylabs/toolchain": "~8.5.12",
|
|
42
|
+
"@xylabs/tsconfig": "~8.5.12",
|
|
49
43
|
"browserslist": "4.28.4",
|
|
50
44
|
"eslint": "^10.6.0",
|
|
51
45
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
52
|
-
"typescript": "~6.0.3"
|
|
53
|
-
"zod": "^4.4.3"
|
|
46
|
+
"typescript": "~6.0.3"
|
|
54
47
|
},
|
|
55
48
|
"peerDependencies": {
|
|
49
|
+
"@ariestools/sdk": "^7.0.4",
|
|
50
|
+
"@bitauth/libauth": "~3.0",
|
|
51
|
+
"@noble/post-quantum": "~0.6.1",
|
|
56
52
|
"@opentelemetry/api": "^1.9",
|
|
57
53
|
"@opentelemetry/sdk-trace-base": "^2.7",
|
|
58
54
|
"@scure/base": "~2.2",
|
|
59
|
-
"@
|
|
55
|
+
"@scure/bip39": "~2.2",
|
|
56
|
+
"@xylabs/geo": "^7.0",
|
|
57
|
+
"@xylabs/threads": "^7.0",
|
|
58
|
+
"ajv": "^8.20",
|
|
60
59
|
"async-mutex": "^0.5",
|
|
60
|
+
"debug": "^4.4",
|
|
61
|
+
"ethers": "^6.16",
|
|
62
|
+
"hash-wasm": "~4.12",
|
|
63
|
+
"idb": "^8.0",
|
|
64
|
+
"observable-fns": "^0.6",
|
|
61
65
|
"zod": "^4.4"
|
|
62
66
|
},
|
|
63
67
|
"engines": {
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { Hash } from '@xylabs/sdk';
|
|
2
|
-
import type { XyoAddress } from '@xyo-network/address';
|
|
3
|
-
import type { PrivateKeyInstance, PublicKeyInstance } from '@xyo-network/key-model';
|
|
4
|
-
import type { PreviousHashStore } from '@xyo-network/previous-hash-store-model';
|
|
5
|
-
import type { AccountAlgorithm } from './Algorithm.ts';
|
|
6
|
-
import type { SignJwtOptions, SignJwtResult } from './Jwt/types.ts';
|
|
7
|
-
export declare const ethMessagePrefix = "\u0019Ethereum Signed Message:\n";
|
|
8
|
-
export interface PhraseInitializationConfig {
|
|
9
|
-
phrase: string;
|
|
10
|
-
}
|
|
11
|
-
export interface PrivateKeyInitializationConfig {
|
|
12
|
-
privateKey: ArrayBufferLike;
|
|
13
|
-
}
|
|
14
|
-
export interface MnemonicInitializationConfig {
|
|
15
|
-
mnemonic: string;
|
|
16
|
-
path?: string;
|
|
17
|
-
}
|
|
18
|
-
export interface AccountOptions {
|
|
19
|
-
previousHash?: ArrayBufferLike;
|
|
20
|
-
}
|
|
21
|
-
export type InitializationConfig = PhraseInitializationConfig | PrivateKeyInitializationConfig | MnemonicInitializationConfig;
|
|
22
|
-
export type AccountConfig = InitializationConfig & AccountOptions;
|
|
23
|
-
export declare const isPhraseInitializationConfig: (value: unknown) => value is PhraseInitializationConfig;
|
|
24
|
-
export declare const isPrivateKeyInitializationConfig: (value: unknown) => value is PrivateKeyInitializationConfig;
|
|
25
|
-
export declare const isMnemonicInitializationConfig: (value: unknown) => value is MnemonicInitializationConfig;
|
|
26
|
-
export declare const isInitializationConfig: (value: unknown) => value is InitializationConfig;
|
|
27
|
-
export interface AccountInstance {
|
|
28
|
-
readonly address: XyoAddress;
|
|
29
|
-
readonly addressBytes: ArrayBufferLike;
|
|
30
|
-
readonly algorithm: AccountAlgorithm;
|
|
31
|
-
previousHash: Hash | undefined;
|
|
32
|
-
previousHashBytes: ArrayBufferLike | undefined;
|
|
33
|
-
readonly private?: PrivateKeyInstance;
|
|
34
|
-
readonly public?: PublicKeyInstance;
|
|
35
|
-
sign: (hash: ArrayBufferLike, previousHash?: ArrayBufferLike) => Promise<[ArrayBufferLike, Hash?]>;
|
|
36
|
-
signJwt: (options: SignJwtOptions) => Promise<SignJwtResult>;
|
|
37
|
-
verify: (msg: ArrayBufferLike, signature: ArrayBufferLike) => Promise<boolean>;
|
|
38
|
-
}
|
|
39
|
-
export declare const isAccountInstance: (account: unknown) => account is AccountInstance;
|
|
40
|
-
export interface AccountStatic<T extends AccountInstance = AccountInstance, C extends AccountConfig = AccountConfig> {
|
|
41
|
-
previousHashStore?: PreviousHashStore;
|
|
42
|
-
create(options?: C): Promise<T>;
|
|
43
|
-
fromPrivateKey(key: ArrayBufferLike | bigint | string): Promise<AccountInstance>;
|
|
44
|
-
random(): Promise<AccountInstance>;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=Account.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Account.d.ts","sourceRoot":"","sources":["../../src/Account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,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;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AI,CAAC,CAAC,CAAC,CAAA;IAClG,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,aAAa,CAAC,CAAA;IAC5D,MAAM,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC/E;AAED,eAAO,MAAM,iBAAiB,GAAI,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"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type AccountAlgorithm = 'secp256k1' | 'ml-dsa-65';
|
|
2
|
-
export declare const AccountAlgorithmHrp: Partial<Record<AccountAlgorithm, string>>;
|
|
3
|
-
export declare function hrpForAlgorithm(algorithm: AccountAlgorithm): string | undefined;
|
|
4
|
-
export declare function algorithmFromAddress(address: string): AccountAlgorithm;
|
|
5
|
-
//# sourceMappingURL=Algorithm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Algorithm.d.ts","sourceRoot":"","sources":["../../src/Algorithm.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,WAAW,CAAA;AAUxD,eAAO,MAAM,mBAAmB,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAA2C,CAAA;AAMrH,wBAAgB,eAAe,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CAE/E;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAStE"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Enum } from '@xylabs/sdk';
|
|
2
|
-
export declare const JwtAlg: Enum<{
|
|
3
|
-
ES256K: "ES256K";
|
|
4
|
-
}>;
|
|
5
|
-
export type JwtAlg = Enum<typeof JwtAlg>;
|
|
6
|
-
export declare const JwtTyp: Enum<{
|
|
7
|
-
JWT: "JWT";
|
|
8
|
-
}>;
|
|
9
|
-
export type JwtTyp = Enum<typeof JwtTyp>;
|
|
10
|
-
export declare const JwtSchema: Enum<{
|
|
11
|
-
Signin: "network.xyo.auth.signin";
|
|
12
|
-
}>;
|
|
13
|
-
export type JwtSchema = Enum<typeof JwtSchema>;
|
|
14
|
-
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/Jwt/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,eAAO,MAAM,MAAM;;EAAsC,CAAA;AACzD,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,MAAM,CAAC,CAAA;AAExC,eAAO,MAAM,MAAM;;EAAgC,CAAA;AACnD,MAAM,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,MAAM,CAAC,CAAA;AAExC,eAAO,MAAM,SAAS;;EAAuD,CAAA;AAC7E,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,SAAS,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Jwt/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export interface JwtHeader {
|
|
2
|
-
alg: string;
|
|
3
|
-
kid: string;
|
|
4
|
-
pub: string;
|
|
5
|
-
typ: string;
|
|
6
|
-
}
|
|
7
|
-
export interface JwtClaims {
|
|
8
|
-
aud: string;
|
|
9
|
-
exp: number;
|
|
10
|
-
iat: number;
|
|
11
|
-
iss: string;
|
|
12
|
-
nbf?: number;
|
|
13
|
-
nonce?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface JwtPayload extends JwtClaims {
|
|
16
|
-
[key: string]: unknown;
|
|
17
|
-
schema: string;
|
|
18
|
-
}
|
|
19
|
-
export interface JwtParts {
|
|
20
|
-
header: JwtHeader;
|
|
21
|
-
headerB64: string;
|
|
22
|
-
payload: JwtPayload;
|
|
23
|
-
payloadB64: string;
|
|
24
|
-
signature: Uint8Array;
|
|
25
|
-
signatureB64: string;
|
|
26
|
-
}
|
|
27
|
-
export interface SignJwtOptions {
|
|
28
|
-
audience: string;
|
|
29
|
-
claims?: Record<string, unknown>;
|
|
30
|
-
exp?: number;
|
|
31
|
-
now?: number;
|
|
32
|
-
schema?: string;
|
|
33
|
-
ttl?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface SignJwtResult {
|
|
36
|
-
header: JwtHeader;
|
|
37
|
-
payload: JwtPayload;
|
|
38
|
-
token: string;
|
|
39
|
-
}
|
|
40
|
-
export interface VerifyJwtOptions {
|
|
41
|
-
audience?: string;
|
|
42
|
-
now?: number;
|
|
43
|
-
}
|
|
44
|
-
export interface VerifyJwtSuccess {
|
|
45
|
-
header: JwtHeader;
|
|
46
|
-
ok: true;
|
|
47
|
-
payload: JwtPayload;
|
|
48
|
-
}
|
|
49
|
-
export interface VerifyJwtFailure {
|
|
50
|
-
header?: JwtHeader;
|
|
51
|
-
ok: false;
|
|
52
|
-
payload?: JwtPayload;
|
|
53
|
-
reasons: string[];
|
|
54
|
-
}
|
|
55
|
-
export type VerifyJwtResult = VerifyJwtSuccess | VerifyJwtFailure;
|
|
56
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gBAAgB;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,CAAA;IACjB,EAAE,EAAE,IAAI,CAAA;IACR,OAAO,EAAE,UAAU,CAAA;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,EAAE,EAAE,KAAK,CAAA;IACT,OAAO,CAAC,EAAE,UAAU,CAAA;IACpB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,gBAAgB,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { AccountAlgorithm } from './Algorithm.ts';
|
|
2
|
-
export type VerifySignatureFn = (address: string, hash: ArrayBufferLike, signature: ArrayBufferLike) => Promise<boolean>;
|
|
3
|
-
export declare function registerVerifier(algorithm: AccountAlgorithm, fn: VerifySignatureFn): void;
|
|
4
|
-
export declare function getVerifier(algorithm: AccountAlgorithm): VerifySignatureFn | undefined;
|
|
5
|
-
export declare function verifySignature(address: string, hash: ArrayBufferLike, signature: ArrayBufferLike): Promise<boolean>;
|
|
6
|
-
//# sourceMappingURL=VerifierRegistry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VerifierRegistry.d.ts","sourceRoot":"","sources":["../../src/VerifierRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGtD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAIxH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,EAAE,EAAE,EAAE,iBAAiB,GAAG,IAAI,CAEzF;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,SAAS,CAEtF;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAO1H"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addressTo20Bytes.d.ts","sourceRoot":"","sources":["../../src/addressTo20Bytes.ts"],"names":[],"mappings":"AAGA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAIjE"}
|