@icp-sdk/core 5.3.1 → 6.0.0
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/cjs/agent/actor.d.ts +7 -3
- package/lib/cjs/agent/actor.d.ts.map +1 -1
- package/lib/cjs/agent/actor.js +18 -5
- package/lib/cjs/agent/actor.js.map +1 -1
- package/lib/cjs/agent/agent/api.d.ts +35 -6
- package/lib/cjs/agent/agent/api.d.ts.map +1 -1
- package/lib/cjs/agent/agent/api.js.map +1 -1
- package/lib/cjs/agent/agent/http/index.d.ts +11 -25
- package/lib/cjs/agent/agent/http/index.d.ts.map +1 -1
- package/lib/cjs/agent/agent/http/index.js +198 -173
- package/lib/cjs/agent/agent/http/index.js.map +1 -1
- package/lib/cjs/agent/auth.d.ts +6 -5
- package/lib/cjs/agent/auth.d.ts.map +1 -1
- package/lib/cjs/agent/auth.js +3 -3
- package/lib/cjs/agent/auth.js.map +1 -1
- package/lib/cjs/agent/canisterStatus/index.d.ts.map +1 -1
- package/lib/cjs/agent/canisterStatus/index.js +10 -10
- package/lib/cjs/agent/canisterStatus/index.js.map +1 -1
- package/lib/cjs/agent/cbor.d.ts +2 -1
- package/lib/cjs/agent/cbor.d.ts.map +1 -1
- package/lib/cjs/agent/cbor.js +4 -1
- package/lib/cjs/agent/cbor.js.map +1 -1
- package/lib/cjs/agent/certificate.d.ts +5 -4
- package/lib/cjs/agent/certificate.d.ts.map +1 -1
- package/lib/cjs/agent/certificate.js +14 -18
- package/lib/cjs/agent/certificate.js.map +1 -1
- package/lib/cjs/agent/der.d.ts +3 -2
- package/lib/cjs/agent/der.d.ts.map +1 -1
- package/lib/cjs/agent/der.js.map +1 -1
- package/lib/cjs/agent/errors.d.ts +7 -1
- package/lib/cjs/agent/errors.d.ts.map +1 -1
- package/lib/cjs/agent/errors.js +34 -16
- package/lib/cjs/agent/errors.js.map +1 -1
- package/lib/cjs/agent/polling/index.d.ts +3 -4
- package/lib/cjs/agent/polling/index.d.ts.map +1 -1
- package/lib/cjs/agent/polling/index.js +17 -10
- package/lib/cjs/agent/polling/index.js.map +1 -1
- package/lib/cjs/agent/polling/strategy.d.ts.map +1 -1
- package/lib/cjs/agent/polling/strategy.js +6 -6
- package/lib/cjs/agent/polling/strategy.js.map +1 -1
- package/lib/cjs/agent/polling/types.d.ts +3 -4
- package/lib/cjs/agent/polling/types.d.ts.map +1 -1
- package/lib/cjs/agent/public_key.d.ts +3 -2
- package/lib/cjs/agent/public_key.d.ts.map +1 -1
- package/lib/cjs/agent/public_key.js +2 -2
- package/lib/cjs/agent/public_key.js.map +1 -1
- package/lib/cjs/agent/request_id.js +10 -10
- package/lib/cjs/agent/request_id.js.map +1 -1
- package/lib/cjs/agent/subnetStatus/index.js +7 -7
- package/lib/cjs/agent/subnetStatus/index.js.map +1 -1
- package/lib/cjs/agent/utils/bls.d.ts.map +1 -1
- package/lib/cjs/agent/utils/bls.js +7 -6
- package/lib/cjs/agent/utils/bls.js.map +1 -1
- package/lib/cjs/agent/utils/readState.d.ts +2 -2
- package/lib/cjs/agent/utils/readState.d.ts.map +1 -1
- package/lib/cjs/agent/utils/readState.js +4 -4
- package/lib/cjs/agent/utils/readState.js.map +1 -1
- package/lib/cjs/agent/utils/target.d.ts +15 -0
- package/lib/cjs/agent/utils/target.d.ts.map +1 -0
- package/lib/cjs/agent/utils/target.js +27 -0
- package/lib/cjs/agent/utils/target.js.map +1 -0
- package/lib/cjs/candid/utils/buffer.d.ts +2 -1
- package/lib/cjs/candid/utils/buffer.d.ts.map +1 -1
- package/lib/cjs/candid/utils/buffer.js +5 -2
- package/lib/cjs/candid/utils/buffer.js.map +1 -1
- package/lib/cjs/identity/identity/attributes.d.ts +6 -2
- package/lib/cjs/identity/identity/attributes.d.ts.map +1 -1
- package/lib/cjs/identity/identity/attributes.js +9 -1
- package/lib/cjs/identity/identity/attributes.js.map +1 -1
- package/lib/cjs/identity/identity/delegation.d.ts +10 -3
- package/lib/cjs/identity/identity/delegation.d.ts.map +1 -1
- package/lib/cjs/identity/identity/delegation.js +25 -12
- package/lib/cjs/identity/identity/delegation.js.map +1 -1
- package/lib/cjs/identity/identity/ecdsa.d.ts +2 -2
- package/lib/cjs/identity/identity/ecdsa.d.ts.map +1 -1
- package/lib/cjs/identity/identity/ecdsa.js +3 -2
- package/lib/cjs/identity/identity/ecdsa.js.map +1 -1
- package/lib/cjs/identity/identity/ed25519.d.ts +3 -2
- package/lib/cjs/identity/identity/ed25519.d.ts.map +1 -1
- package/lib/cjs/identity/identity/ed25519.js +18 -15
- package/lib/cjs/identity/identity/ed25519.js.map +1 -1
- package/lib/cjs/identity/identity/webauthn.d.ts +4 -3
- package/lib/cjs/identity/identity/webauthn.d.ts.map +1 -1
- package/lib/cjs/identity/identity/webauthn.js +12 -11
- package/lib/cjs/identity/identity/webauthn.js.map +1 -1
- package/lib/cjs/identity/secp256k1/der.d.ts +2 -1
- package/lib/cjs/identity/secp256k1/der.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/der.js.map +1 -1
- package/lib/cjs/identity/secp256k1/pem.d.ts +4 -3
- package/lib/cjs/identity/secp256k1/pem.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/pem.js +2 -2
- package/lib/cjs/identity/secp256k1/pem.js.map +1 -1
- package/lib/cjs/identity/secp256k1/secp256k1.d.ts +5 -4
- package/lib/cjs/identity/secp256k1/secp256k1.d.ts.map +1 -1
- package/lib/cjs/identity/secp256k1/secp256k1.js +17 -20
- package/lib/cjs/identity/secp256k1/secp256k1.js.map +1 -1
- package/lib/cjs/principal/principal.js +5 -5
- package/lib/cjs/principal/principal.js.map +1 -1
- package/lib/esm/agent/actor.d.ts +7 -3
- package/lib/esm/agent/actor.d.ts.map +1 -1
- package/lib/esm/agent/actor.js +18 -5
- package/lib/esm/agent/actor.js.map +1 -1
- package/lib/esm/agent/agent/api.d.ts +35 -6
- package/lib/esm/agent/agent/api.d.ts.map +1 -1
- package/lib/esm/agent/agent/api.js.map +1 -1
- package/lib/esm/agent/agent/http/index.d.ts +11 -25
- package/lib/esm/agent/agent/http/index.d.ts.map +1 -1
- package/lib/esm/agent/agent/http/index.js +191 -166
- package/lib/esm/agent/agent/http/index.js.map +1 -1
- package/lib/esm/agent/auth.d.ts +6 -5
- package/lib/esm/agent/auth.d.ts.map +1 -1
- package/lib/esm/agent/auth.js +1 -1
- package/lib/esm/agent/auth.js.map +1 -1
- package/lib/esm/agent/canister-env/index.js +1 -1
- package/lib/esm/agent/canister-env/index.js.map +1 -1
- package/lib/esm/agent/canisterStatus/index.d.ts.map +1 -1
- package/lib/esm/agent/canisterStatus/index.js +2 -2
- package/lib/esm/agent/canisterStatus/index.js.map +1 -1
- package/lib/esm/agent/cbor.d.ts +2 -1
- package/lib/esm/agent/cbor.d.ts.map +1 -1
- package/lib/esm/agent/cbor.js +4 -1
- package/lib/esm/agent/cbor.js.map +1 -1
- package/lib/esm/agent/certificate.d.ts +5 -4
- package/lib/esm/agent/certificate.d.ts.map +1 -1
- package/lib/esm/agent/certificate.js +5 -9
- package/lib/esm/agent/certificate.js.map +1 -1
- package/lib/esm/agent/der.d.ts +3 -2
- package/lib/esm/agent/der.d.ts.map +1 -1
- package/lib/esm/agent/der.js.map +1 -1
- package/lib/esm/agent/errors.d.ts +7 -1
- package/lib/esm/agent/errors.d.ts.map +1 -1
- package/lib/esm/agent/errors.js +18 -1
- package/lib/esm/agent/errors.js.map +1 -1
- package/lib/esm/agent/polling/index.d.ts +3 -4
- package/lib/esm/agent/polling/index.d.ts.map +1 -1
- package/lib/esm/agent/polling/index.js +15 -8
- package/lib/esm/agent/polling/index.js.map +1 -1
- package/lib/esm/agent/polling/strategy.d.ts.map +1 -1
- package/lib/esm/agent/polling/strategy.js +6 -6
- package/lib/esm/agent/polling/strategy.js.map +1 -1
- package/lib/esm/agent/polling/types.d.ts +3 -4
- package/lib/esm/agent/polling/types.d.ts.map +1 -1
- package/lib/esm/agent/public_key.d.ts +3 -2
- package/lib/esm/agent/public_key.d.ts.map +1 -1
- package/lib/esm/agent/public_key.js +2 -2
- package/lib/esm/agent/public_key.js.map +1 -1
- package/lib/esm/agent/request_id.js +2 -2
- package/lib/esm/agent/request_id.js.map +1 -1
- package/lib/esm/agent/subnetStatus/index.js +1 -1
- package/lib/esm/agent/subnetStatus/index.js.map +1 -1
- package/lib/esm/agent/utils/bls.d.ts.map +1 -1
- package/lib/esm/agent/utils/bls.js +7 -6
- package/lib/esm/agent/utils/bls.js.map +1 -1
- package/lib/esm/agent/utils/readState.d.ts +2 -2
- package/lib/esm/agent/utils/readState.d.ts.map +1 -1
- package/lib/esm/agent/utils/readState.js +1 -1
- package/lib/esm/agent/utils/readState.js.map +1 -1
- package/lib/esm/agent/utils/target.d.ts +15 -0
- package/lib/esm/agent/utils/target.d.ts.map +1 -0
- package/lib/esm/agent/utils/target.js +23 -0
- package/lib/esm/agent/utils/target.js.map +1 -0
- package/lib/esm/candid/utils/buffer.d.ts +2 -1
- package/lib/esm/candid/utils/buffer.d.ts.map +1 -1
- package/lib/esm/candid/utils/buffer.js +5 -2
- package/lib/esm/candid/utils/buffer.js.map +1 -1
- package/lib/esm/identity/identity/attributes.d.ts +6 -2
- package/lib/esm/identity/identity/attributes.d.ts.map +1 -1
- package/lib/esm/identity/identity/attributes.js +9 -1
- package/lib/esm/identity/identity/attributes.js.map +1 -1
- package/lib/esm/identity/identity/delegation.d.ts +10 -3
- package/lib/esm/identity/identity/delegation.d.ts.map +1 -1
- package/lib/esm/identity/identity/delegation.js +22 -9
- package/lib/esm/identity/identity/delegation.js.map +1 -1
- package/lib/esm/identity/identity/ecdsa.d.ts +2 -2
- package/lib/esm/identity/identity/ecdsa.d.ts.map +1 -1
- package/lib/esm/identity/identity/ecdsa.js +3 -2
- package/lib/esm/identity/identity/ecdsa.js.map +1 -1
- package/lib/esm/identity/identity/ed25519.d.ts +3 -2
- package/lib/esm/identity/identity/ed25519.d.ts.map +1 -1
- package/lib/esm/identity/identity/ed25519.js +10 -7
- package/lib/esm/identity/identity/ed25519.js.map +1 -1
- package/lib/esm/identity/identity/webauthn.d.ts +4 -3
- package/lib/esm/identity/identity/webauthn.d.ts.map +1 -1
- package/lib/esm/identity/identity/webauthn.js +8 -7
- package/lib/esm/identity/identity/webauthn.js.map +1 -1
- package/lib/esm/identity/secp256k1/der.d.ts +2 -1
- package/lib/esm/identity/secp256k1/der.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/der.js.map +1 -1
- package/lib/esm/identity/secp256k1/pem.d.ts +4 -3
- package/lib/esm/identity/secp256k1/pem.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/pem.js +2 -2
- package/lib/esm/identity/secp256k1/pem.js.map +1 -1
- package/lib/esm/identity/secp256k1/secp256k1.d.ts +5 -4
- package/lib/esm/identity/secp256k1/secp256k1.d.ts.map +1 -1
- package/lib/esm/identity/secp256k1/secp256k1.js +10 -13
- package/lib/esm/identity/secp256k1/secp256k1.js.map +1 -1
- package/lib/esm/principal/principal.js +2 -2
- package/lib/esm/principal/principal.js.map +1 -1
- package/package.json +20 -10
- package/src/agent/actor.ts +0 -524
- package/src/agent/agent/api.ts +0 -292
- package/src/agent/agent/http/expiry.ts +0 -107
- package/src/agent/agent/http/index.ts +0 -1727
- package/src/agent/agent/http/transforms.ts +0 -54
- package/src/agent/agent/http/types.ts +0 -145
- package/src/agent/agent/index.ts +0 -4
- package/src/agent/auth.ts +0 -147
- package/src/agent/canister-env/index.ts +0 -192
- package/src/agent/canisterStatus/index.ts +0 -260
- package/src/agent/cbor.ts +0 -63
- package/src/agent/certificate.ts +0 -1058
- package/src/agent/constants.ts +0 -24
- package/src/agent/der.ts +0 -191
- package/src/agent/errors.ts +0 -962
- package/src/agent/fetch_candid.ts +0 -37
- package/src/agent/index.ts +0 -130
- package/src/agent/observable.ts +0 -49
- package/src/agent/polling/backoff.ts +0 -129
- package/src/agent/polling/index.ts +0 -238
- package/src/agent/polling/strategy.ts +0 -140
- package/src/agent/polling/types.ts +0 -28
- package/src/agent/public_key.ts +0 -65
- package/src/agent/request_id.ts +0 -99
- package/src/agent/subnetStatus/index.ts +0 -263
- package/src/agent/utils/bls.ts +0 -18
- package/src/agent/utils/buffer.ts +0 -64
- package/src/agent/utils/certificateReject.ts +0 -25
- package/src/agent/utils/createExpirableStore.ts +0 -31
- package/src/agent/utils/expirableStore.ts +0 -47
- package/src/agent/utils/inMemoryExpirableStore.ts +0 -49
- package/src/agent/utils/indexedDBExpirableStore.ts +0 -191
- package/src/agent/utils/leb.ts +0 -14
- package/src/agent/utils/random.ts +0 -30
- package/src/agent/utils/readState.ts +0 -180
- package/src/candid/candid-core.ts +0 -274
- package/src/candid/candid-ui.ts +0 -281
- package/src/candid/idl.ts +0 -2654
- package/src/candid/index.ts +0 -35
- package/src/candid/types.ts +0 -7
- package/src/candid/utils/bigint-math.ts +0 -26
- package/src/candid/utils/buffer.ts +0 -221
- package/src/candid/utils/hash.ts +0 -31
- package/src/candid/utils/leb128.ts +0 -233
- package/src/identity/identity/attributes.ts +0 -84
- package/src/identity/identity/delegation.ts +0 -411
- package/src/identity/identity/ecdsa.ts +0 -162
- package/src/identity/identity/ed25519.ts +0 -246
- package/src/identity/identity/partial.ts +0 -60
- package/src/identity/identity/webauthn.ts +0 -265
- package/src/identity/index.ts +0 -44
- package/src/identity/secp256k1/der.ts +0 -177
- package/src/identity/secp256k1/index.ts +0 -52
- package/src/identity/secp256k1/pem.ts +0 -39
- package/src/identity/secp256k1/secp256k1.ts +0 -276
- package/src/index.ts +0 -3
- package/src/principal/index.ts +0 -19
- package/src/principal/principal.ts +0 -181
- package/src/principal/utils/base32.ts +0 -101
- package/src/principal/utils/getCrc.ts +0 -52
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { uint8Equals } from '#candid';
|
|
2
|
-
|
|
3
|
-
export const encodeLenBytes = (len: number): number => {
|
|
4
|
-
if (len <= 0x7f) {
|
|
5
|
-
return 1;
|
|
6
|
-
}
|
|
7
|
-
if (len <= 0xff) {
|
|
8
|
-
return 2;
|
|
9
|
-
}
|
|
10
|
-
if (len <= 0xffff) {
|
|
11
|
-
return 3;
|
|
12
|
-
}
|
|
13
|
-
if (len <= 0xffffff) {
|
|
14
|
-
return 4;
|
|
15
|
-
}
|
|
16
|
-
throw new Error('Length too long (> 4 bytes)');
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export const encodeLen = (buf: Uint8Array, offset: number, len: number): number => {
|
|
20
|
-
if (len <= 0x7f) {
|
|
21
|
-
buf[offset] = len;
|
|
22
|
-
return 1;
|
|
23
|
-
}
|
|
24
|
-
if (len <= 0xff) {
|
|
25
|
-
buf[offset] = 0x81;
|
|
26
|
-
buf[offset + 1] = len;
|
|
27
|
-
return 2;
|
|
28
|
-
}
|
|
29
|
-
if (len <= 0xffff) {
|
|
30
|
-
buf[offset] = 0x82;
|
|
31
|
-
buf[offset + 1] = len >> 8;
|
|
32
|
-
buf[offset + 2] = len;
|
|
33
|
-
return 3;
|
|
34
|
-
}
|
|
35
|
-
if (len <= 0xffffff) {
|
|
36
|
-
buf[offset] = 0x83;
|
|
37
|
-
buf[offset + 1] = len >> 16;
|
|
38
|
-
buf[offset + 2] = len >> 8;
|
|
39
|
-
buf[offset + 3] = len;
|
|
40
|
-
return 4;
|
|
41
|
-
}
|
|
42
|
-
throw new Error('Length too long (> 4 bytes)');
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const decodeLenBytes = (buf: Uint8Array, offset: number): number => {
|
|
46
|
-
if (buf[offset] < 0x80) {
|
|
47
|
-
return 1;
|
|
48
|
-
}
|
|
49
|
-
if (buf[offset] === 0x80) {
|
|
50
|
-
throw new Error('Invalid length 0');
|
|
51
|
-
}
|
|
52
|
-
if (buf[offset] === 0x81) {
|
|
53
|
-
return 2;
|
|
54
|
-
}
|
|
55
|
-
if (buf[offset] === 0x82) {
|
|
56
|
-
return 3;
|
|
57
|
-
}
|
|
58
|
-
if (buf[offset] === 0x83) {
|
|
59
|
-
return 4;
|
|
60
|
-
}
|
|
61
|
-
throw new Error('Length too long (> 4 bytes)');
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const decodeLen = (buf: Uint8Array, offset: number): number => {
|
|
65
|
-
const lenBytes = decodeLenBytes(buf, offset);
|
|
66
|
-
if (lenBytes === 1) {
|
|
67
|
-
return buf[offset];
|
|
68
|
-
}
|
|
69
|
-
if (lenBytes === 2) {
|
|
70
|
-
return buf[offset + 1];
|
|
71
|
-
}
|
|
72
|
-
if (lenBytes === 3) {
|
|
73
|
-
return (buf[offset + 1] << 8) + buf[offset + 2];
|
|
74
|
-
}
|
|
75
|
-
if (lenBytes === 4) {
|
|
76
|
-
return (buf[offset + 1] << 16) + (buf[offset + 2] << 8) + buf[offset + 3];
|
|
77
|
-
}
|
|
78
|
-
throw new Error('Length too long (> 4 bytes)');
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* A DER encoded `SEQUENCE(OID)` for DER-encoded-COSE
|
|
83
|
-
*/
|
|
84
|
-
export const DER_COSE_OID = Uint8Array.from([
|
|
85
|
-
...[0x30, 0x0c], // SEQUENCE
|
|
86
|
-
...[0x06, 0x0a], // OID with 10 bytes
|
|
87
|
-
...[0x2b, 0x06, 0x01, 0x04, 0x01, 0x83, 0xb8, 0x43, 0x01, 0x01], // DER encoded COSE
|
|
88
|
-
]);
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* A DER encoded `SEQUENCE(OID)` for the Ed25519 algorithm
|
|
92
|
-
*/
|
|
93
|
-
export const ED25519_OID = Uint8Array.from([
|
|
94
|
-
...[0x30, 0x05], // SEQUENCE
|
|
95
|
-
...[0x06, 0x03], // OID with 3 bytes
|
|
96
|
-
...[0x2b, 0x65, 0x70], // id-Ed25519 OID
|
|
97
|
-
]);
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* A DER encoded `SEQUENCE(OID)` for secp256k1 with the ECDSA algorithm
|
|
101
|
-
*/
|
|
102
|
-
export const SECP256K1_OID = Uint8Array.from([
|
|
103
|
-
...[0x30, 0x10], // SEQUENCE
|
|
104
|
-
...[0x06, 0x07], // OID with 7 bytes
|
|
105
|
-
...[0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01], // OID ECDSA
|
|
106
|
-
...[0x06, 0x05], // OID with 5 bytes
|
|
107
|
-
...[0x2b, 0x81, 0x04, 0x00, 0x0a], // OID secp256k1
|
|
108
|
-
]);
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Wraps the given `payload` in a DER encoding tagged with the given encoded `oid` like so:
|
|
112
|
-
* `SEQUENCE(oid, BITSTRING(payload))`
|
|
113
|
-
* @param payload The payload to encode as the bit string
|
|
114
|
-
* @param oid The DER encoded (and SEQUENCE wrapped!) OID to tag the payload with
|
|
115
|
-
*/
|
|
116
|
-
export function wrapDER(payload: Uint8Array, oid: Uint8Array): Uint8Array {
|
|
117
|
-
// The Bit String header needs to include the unused bit count byte in its length
|
|
118
|
-
const bitStringHeaderLength = 2 + encodeLenBytes(payload.byteLength + 1);
|
|
119
|
-
const len = oid.byteLength + bitStringHeaderLength + payload.byteLength;
|
|
120
|
-
let offset = 0;
|
|
121
|
-
const buf = new Uint8Array(1 + encodeLenBytes(len) + len);
|
|
122
|
-
// Sequence
|
|
123
|
-
buf[offset++] = 0x30;
|
|
124
|
-
// Sequence Length
|
|
125
|
-
offset += encodeLen(buf, offset, len);
|
|
126
|
-
|
|
127
|
-
// OID
|
|
128
|
-
buf.set(oid, offset);
|
|
129
|
-
offset += oid.byteLength;
|
|
130
|
-
|
|
131
|
-
// Bit String Header
|
|
132
|
-
buf[offset++] = 0x03;
|
|
133
|
-
offset += encodeLen(buf, offset, payload.byteLength + 1);
|
|
134
|
-
// 0 padding
|
|
135
|
-
buf[offset++] = 0x00;
|
|
136
|
-
buf.set(new Uint8Array(payload), offset);
|
|
137
|
-
|
|
138
|
-
return buf;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Extracts a payload from the given `derEncoded` data, and checks that it was tagged with the given `oid`.
|
|
143
|
-
*
|
|
144
|
-
* `derEncoded = SEQUENCE(oid, BITSTRING(payload))`
|
|
145
|
-
* @param derEncoded The DER encoded and tagged data
|
|
146
|
-
* @param oid The DER encoded (and SEQUENCE wrapped!) expected OID
|
|
147
|
-
* @returns The unwrapped payload
|
|
148
|
-
*/
|
|
149
|
-
export const unwrapDER = (derEncoded: Uint8Array, oid: Uint8Array): Uint8Array => {
|
|
150
|
-
let offset = 0;
|
|
151
|
-
const expect = (n: number, msg: string) => {
|
|
152
|
-
if (buf[offset++] !== n) {
|
|
153
|
-
throw new Error(`Expected: ${msg}`);
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
const buf = new Uint8Array(derEncoded);
|
|
158
|
-
expect(0x30, 'sequence');
|
|
159
|
-
offset += decodeLenBytes(buf, offset);
|
|
160
|
-
|
|
161
|
-
if (!uint8Equals(buf.slice(offset, offset + oid.byteLength), oid)) {
|
|
162
|
-
throw new Error('Not the expected OID.');
|
|
163
|
-
}
|
|
164
|
-
offset += oid.byteLength;
|
|
165
|
-
|
|
166
|
-
expect(0x03, 'bit string');
|
|
167
|
-
const payloadLen = decodeLen(buf, offset) - 1; // Subtracting 1 to account for the 0 padding
|
|
168
|
-
offset += decodeLenBytes(buf, offset);
|
|
169
|
-
expect(0x00, '0 padding');
|
|
170
|
-
const result = buf.slice(offset);
|
|
171
|
-
if (payloadLen !== result.length) {
|
|
172
|
-
throw new Error(
|
|
173
|
-
`DER payload mismatch: Expected length ${payloadLen} actual length ${result.length}`,
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
return result;
|
|
177
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `@icp-sdk/core/identity/secp256k1` module provides an implementation of the [`SignIdentity`](https://js.icp.build/core/latest/libs/agent/api/classes/signidentity/) interface for the secp256k1 elliptic curve. It allows you to create and manage key pairs for signing and verification of messages.
|
|
3
|
-
*
|
|
4
|
-
* ## Usage
|
|
5
|
-
*
|
|
6
|
-
* Here's an example of how to use the `Secp256k1KeyIdentity` class to generate a new key pair and sign and verify a message:
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* import { Secp256k1KeyIdentity } from '@icp-sdk/core/identity/secp256k1';
|
|
10
|
-
*
|
|
11
|
-
* // Generate a new key pair
|
|
12
|
-
* const identity = Secp256k1KeyIdentity.generate();
|
|
13
|
-
*
|
|
14
|
-
* // Sign a message
|
|
15
|
-
* const message = 'Hello, world!';
|
|
16
|
-
* const signature = identity.sign(message);
|
|
17
|
-
*
|
|
18
|
-
* // Verify the signature
|
|
19
|
-
* const isValid = identity.verify(message, signature);
|
|
20
|
-
*
|
|
21
|
-
* console.log(`Signature is ${isValid ? 'valid' : 'invalid'}`);
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* You can also use a seed to generate deterministic key pairs:
|
|
25
|
-
*
|
|
26
|
-
* ```ts
|
|
27
|
-
* import { Secp256k1KeyIdentity } from '@icp-sdk/core/identity/secp256k1';
|
|
28
|
-
*
|
|
29
|
-
* const seed = Buffer.from('my-secret-seed', 'utf8');
|
|
30
|
-
* const identity = Secp256k1KeyIdentity.generate(seed);
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* The Secp256k1KeyIdentity class also provides methods for converting the key pair to and from JSON-serializable objects:
|
|
34
|
-
*
|
|
35
|
-
* ```ts
|
|
36
|
-
* import { Secp256k1KeyIdentity } from '@icp-sdk/core/identity/secp256k1';
|
|
37
|
-
*
|
|
38
|
-
* // Generate a new key pair
|
|
39
|
-
* const identity = Secp256k1KeyIdentity.generate();
|
|
40
|
-
*
|
|
41
|
-
* // Convert the key pair to a JSON-serializable object
|
|
42
|
-
* const json = identity.toJson();
|
|
43
|
-
*
|
|
44
|
-
* // Convert the JSON-serializable object back to a key pair
|
|
45
|
-
* const restoredIdentity = Secp256k1KeyIdentity.fromJson(json);
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* <!-- split here -->
|
|
49
|
-
* @module libs/identity/secp256k1/api
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
export * from './secp256k1.ts';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as asn1js from 'asn1js';
|
|
2
|
-
|
|
3
|
-
const HEADER = `-----BEGIN EC PRIVATE KEY-----`;
|
|
4
|
-
const FOOTER = `-----END EC PRIVATE KEY-----`;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Parse a PEM-encoded key into a Uint8Array
|
|
8
|
-
* @param pem - the PEM-encoded key
|
|
9
|
-
* @returns secret key as a Uint8Array
|
|
10
|
-
*/
|
|
11
|
-
export function pemToSecretKey(pem: string): Uint8Array {
|
|
12
|
-
const lines = pem.trim().split('\n');
|
|
13
|
-
const header = lines[0].trim();
|
|
14
|
-
const footer = lines[lines.length - 1].trim();
|
|
15
|
-
if (lines.length < 3) {
|
|
16
|
-
throw new Error('Invalid PEM format');
|
|
17
|
-
}
|
|
18
|
-
if (!header.startsWith(HEADER)) {
|
|
19
|
-
throw new Error('Invalid PEM header');
|
|
20
|
-
}
|
|
21
|
-
if (!footer.startsWith(FOOTER)) {
|
|
22
|
-
throw new Error('Invalid PEM footer');
|
|
23
|
-
}
|
|
24
|
-
const base64Data = lines.slice(1, -1).join('').replace(/\r?\n/g, '');
|
|
25
|
-
const rawKey = Uint8Array.from(atob(base64Data), c => c.charCodeAt(0));
|
|
26
|
-
|
|
27
|
-
// Parse the key as ASN.1 object
|
|
28
|
-
try {
|
|
29
|
-
const asn1 = asn1js.fromBER(rawKey);
|
|
30
|
-
// OID for secp256k1
|
|
31
|
-
if (!asn1.result.toString().includes(`OBJECT IDENTIFIER : 1.3.132.0.10`)) {
|
|
32
|
-
throw new Error('Invalid curve, must be secp256k1');
|
|
33
|
-
}
|
|
34
|
-
// Returns the 32-byte raw private key at the appropriate offset
|
|
35
|
-
return rawKey.slice(7, 39);
|
|
36
|
-
} catch (error) {
|
|
37
|
-
throw new Error(`Encountered error while parsing PEM key: ${error}`, { cause: error });
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type DerEncodedPublicKey,
|
|
3
|
-
type KeyPair,
|
|
4
|
-
type Signature,
|
|
5
|
-
type PublicKey,
|
|
6
|
-
SignIdentity,
|
|
7
|
-
} from '#agent';
|
|
8
|
-
import { secp256k1 } from '@noble/curves/secp256k1';
|
|
9
|
-
import { sha256 } from '@noble/hashes/sha2';
|
|
10
|
-
import { bytesToHex, hexToBytes, randomBytes } from '@noble/hashes/utils';
|
|
11
|
-
import * as bip39 from '@scure/bip39';
|
|
12
|
-
import { HDKey } from '@scure/bip32';
|
|
13
|
-
import { SECP256K1_OID, unwrapDER, wrapDER } from './der.ts';
|
|
14
|
-
import { pemToSecretKey } from './pem.ts';
|
|
15
|
-
import { uint8FromBufLike } from '#candid';
|
|
16
|
-
|
|
17
|
-
declare type PublicKeyHex = string;
|
|
18
|
-
declare type SecretKeyHex = string;
|
|
19
|
-
export declare type JsonableSecp256k1Identity = [PublicKeyHex, SecretKeyHex];
|
|
20
|
-
|
|
21
|
-
declare type KeyLike = PublicKey | DerEncodedPublicKey | ArrayBuffer | ArrayBufferView | Uint8Array;
|
|
22
|
-
|
|
23
|
-
function isObject(value: unknown) {
|
|
24
|
-
return value !== null && typeof value === 'object';
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export class Secp256k1PublicKey implements PublicKey {
|
|
28
|
-
public static fromRaw(rawKey: Uint8Array): Secp256k1PublicKey {
|
|
29
|
-
return new Secp256k1PublicKey(rawKey);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public static fromDer(derKey: DerEncodedPublicKey): Secp256k1PublicKey {
|
|
33
|
-
return new Secp256k1PublicKey(this.derDecode(derKey));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Construct Secp256k1PublicKey from an existing PublicKey
|
|
38
|
-
* @param {unknown} maybeKey - existing PublicKey, ArrayBuffer, DerEncodedPublicKey, or hex string
|
|
39
|
-
* @returns {Secp256k1PublicKey} Instance of Secp256k1PublicKey
|
|
40
|
-
*/
|
|
41
|
-
public static from(maybeKey: unknown): Secp256k1PublicKey {
|
|
42
|
-
if (typeof maybeKey === 'string') {
|
|
43
|
-
const key = hexToBytes(maybeKey);
|
|
44
|
-
return this.fromRaw(key);
|
|
45
|
-
}
|
|
46
|
-
if (isObject(maybeKey)) {
|
|
47
|
-
const key = maybeKey as KeyLike;
|
|
48
|
-
if (isObject(key) && Object.hasOwnProperty.call(key, '__derEncodedPublicKey__')) {
|
|
49
|
-
return this.fromDer(key as DerEncodedPublicKey);
|
|
50
|
-
}
|
|
51
|
-
if (ArrayBuffer.isView(key)) {
|
|
52
|
-
const view = key as ArrayBufferView;
|
|
53
|
-
return this.fromRaw(uint8FromBufLike(view.buffer));
|
|
54
|
-
}
|
|
55
|
-
if (key instanceof ArrayBuffer) {
|
|
56
|
-
return this.fromRaw(uint8FromBufLike(key));
|
|
57
|
-
}
|
|
58
|
-
if ('rawKey' in key && key['rawKey'] !== undefined) {
|
|
59
|
-
return this.fromRaw(key.rawKey);
|
|
60
|
-
}
|
|
61
|
-
if ('derKey' in key) {
|
|
62
|
-
return this.fromDer(key.derKey as DerEncodedPublicKey);
|
|
63
|
-
}
|
|
64
|
-
if ('toDer' in key) {
|
|
65
|
-
return this.fromDer(key.toDer());
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
throw new Error('Cannot construct Secp256k1PublicKey from the provided key.');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
private static derEncode(publicKey: Uint8Array): DerEncodedPublicKey {
|
|
72
|
-
const key = uint8FromBufLike(wrapDER(publicKey, SECP256K1_OID).buffer) as DerEncodedPublicKey;
|
|
73
|
-
key.__derEncodedPublicKey__ = undefined;
|
|
74
|
-
return key;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private static derDecode(key: DerEncodedPublicKey): Uint8Array {
|
|
78
|
-
return unwrapDER(key, SECP256K1_OID);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
#rawKey: Uint8Array;
|
|
82
|
-
|
|
83
|
-
public get rawKey(): Uint8Array {
|
|
84
|
-
return this.#rawKey;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
#derKey: DerEncodedPublicKey;
|
|
88
|
-
|
|
89
|
-
public get derKey(): DerEncodedPublicKey {
|
|
90
|
-
return this.#derKey;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// `fromRaw` and `fromDer` should be used for instantiation, not this constructor.
|
|
94
|
-
private constructor(key: Uint8Array) {
|
|
95
|
-
this.#rawKey = key;
|
|
96
|
-
this.#derKey = Secp256k1PublicKey.derEncode(key);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public toDer(): DerEncodedPublicKey {
|
|
100
|
-
return this.derKey;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
public toRaw(): Uint8Array {
|
|
104
|
-
return this.rawKey;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export class Secp256k1KeyIdentity extends SignIdentity {
|
|
109
|
-
/**
|
|
110
|
-
* Generates an identity. If a seed is provided, the keys are generated from the
|
|
111
|
-
* seed according to BIP 0032. Otherwise, the key pair is randomly generated.
|
|
112
|
-
* This method throws an error in case the seed is not 32 bytes long or invalid
|
|
113
|
-
* for use as a private key.
|
|
114
|
-
* @param {Uint8Array} seed the optional seed
|
|
115
|
-
* @returns {Secp256k1KeyIdentity} Secp256k1KeyIdentity
|
|
116
|
-
*/
|
|
117
|
-
public static generate(seed?: Uint8Array): Secp256k1KeyIdentity {
|
|
118
|
-
if (seed && seed.byteLength !== 32) {
|
|
119
|
-
throw new Error('Secp256k1 Seed needs to be 32 bytes long.');
|
|
120
|
-
}
|
|
121
|
-
let privateKey: Uint8Array;
|
|
122
|
-
|
|
123
|
-
if (seed) {
|
|
124
|
-
// private key from seed according to https://en.bitcoin.it/wiki/BIP_0032
|
|
125
|
-
// master key generation:
|
|
126
|
-
privateKey = seed;
|
|
127
|
-
if (!secp256k1.utils.isValidPrivateKey(privateKey)) {
|
|
128
|
-
throw new Error('The seed is invalid.');
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
privateKey = randomBytes(32);
|
|
132
|
-
while (!secp256k1.utils.isValidPrivateKey(privateKey)) {
|
|
133
|
-
privateKey = randomBytes(32);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const publicKeyRaw = secp256k1.getPublicKey(privateKey, false);
|
|
138
|
-
|
|
139
|
-
const publicKey = Secp256k1PublicKey.fromRaw(publicKeyRaw);
|
|
140
|
-
return new this(publicKey, privateKey);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
public static fromParsedJson(obj: JsonableSecp256k1Identity): Secp256k1KeyIdentity {
|
|
144
|
-
const [publicKeyRaw, privateKeyRaw] = obj;
|
|
145
|
-
return new Secp256k1KeyIdentity(
|
|
146
|
-
Secp256k1PublicKey.fromRaw(hexToBytes(publicKeyRaw)),
|
|
147
|
-
hexToBytes(privateKeyRaw),
|
|
148
|
-
);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public static fromJSON(json: string): Secp256k1KeyIdentity {
|
|
152
|
-
const parsed = JSON.parse(json);
|
|
153
|
-
if (Array.isArray(parsed)) {
|
|
154
|
-
if (typeof parsed[0] === 'string' && typeof parsed[1] === 'string') {
|
|
155
|
-
return this.fromParsedJson([parsed[0], parsed[1]]);
|
|
156
|
-
}
|
|
157
|
-
throw new Error('Deserialization error: JSON must have at least 2 items.');
|
|
158
|
-
}
|
|
159
|
-
throw new Error(`Deserialization error: Invalid JSON type for string: ${JSON.stringify(json)}`);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* generates an identity from a public and private key. Please ensure that you are generating these keys securely and protect the user's private key
|
|
164
|
-
* @param {Uint8Array} publicKey - Uint8Array
|
|
165
|
-
* @param {Uint8Array} privateKey - Uint8Array
|
|
166
|
-
* @returns {Secp256k1KeyIdentity} Secp256k1KeyIdentity
|
|
167
|
-
*/
|
|
168
|
-
public static fromKeyPair(publicKey: Uint8Array, privateKey: Uint8Array): Secp256k1KeyIdentity {
|
|
169
|
-
return new Secp256k1KeyIdentity(Secp256k1PublicKey.fromRaw(publicKey), privateKey);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* generates an identity from an existing secret key, and is the correct method to generate an identity from a seed phrase. Please ensure you protect the user's private key.
|
|
174
|
-
* @param {Uint8Array} secretKey - Uint8Array
|
|
175
|
-
* @returns {Secp256k1KeyIdentity} - Secp256k1KeyIdentity
|
|
176
|
-
*/
|
|
177
|
-
public static fromSecretKey(secretKey: Uint8Array): Secp256k1KeyIdentity {
|
|
178
|
-
const publicKey = secp256k1.getPublicKey(secretKey, false);
|
|
179
|
-
const identity = Secp256k1KeyIdentity.fromKeyPair(publicKey, secretKey);
|
|
180
|
-
return identity;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Generates an identity from a seed phrase. Use carefully - seed phrases should only be used in secure contexts, and you should avoid having users copying and pasting seed phrases as much as possible.
|
|
185
|
-
* @param {string | string[]} seedPhrase - either an array of words or a string of words separated by spaces.
|
|
186
|
-
* @param password - optional password to be used by bip39
|
|
187
|
-
* @returns Secp256k1KeyIdentity
|
|
188
|
-
*/
|
|
189
|
-
public static fromSeedPhrase(
|
|
190
|
-
seedPhrase: string | string[],
|
|
191
|
-
password?: string | undefined,
|
|
192
|
-
): Secp256k1KeyIdentity {
|
|
193
|
-
// Convert to string for convenience
|
|
194
|
-
const phrase = Array.isArray(seedPhrase) ? seedPhrase.join(' ') : seedPhrase;
|
|
195
|
-
// Warn if provided phrase is not conventional
|
|
196
|
-
if (phrase.split(' ').length < 12 || phrase.split(' ').length > 24) {
|
|
197
|
-
console.warn(
|
|
198
|
-
'Warning - an unusually formatted seed phrase has been provided. Decoding may not work as expected',
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const seed = bip39.mnemonicToSeedSync(phrase, password);
|
|
203
|
-
// Ensure the seed is 64 bytes long
|
|
204
|
-
if (seed.byteLength !== 64) {
|
|
205
|
-
throw new Error('Derived seed must be 64 bytes long.');
|
|
206
|
-
}
|
|
207
|
-
const root = HDKey.fromMasterSeed(seed);
|
|
208
|
-
const addrnode = root.derive("m/44'/223'/0'/0/0");
|
|
209
|
-
|
|
210
|
-
if (!addrnode.privateKey) {
|
|
211
|
-
throw new Error('Failed to derive private key from seed phrase');
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return Secp256k1KeyIdentity.fromSecretKey(addrnode.privateKey);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Utility method to create a Secp256k1KeyIdentity from a PEM-encoded key.
|
|
219
|
-
* @param pemKey - PEM-encoded key as a string
|
|
220
|
-
* @returns - Secp256k1KeyIdentity
|
|
221
|
-
*/
|
|
222
|
-
public static fromPem(pemKey: string): Secp256k1KeyIdentity {
|
|
223
|
-
const secretKey = pemToSecretKey(pemKey);
|
|
224
|
-
return this.fromSecretKey(secretKey);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
_publicKey: Secp256k1PublicKey;
|
|
228
|
-
|
|
229
|
-
protected constructor(
|
|
230
|
-
publicKey: Secp256k1PublicKey,
|
|
231
|
-
protected _privateKey: Uint8Array,
|
|
232
|
-
) {
|
|
233
|
-
super();
|
|
234
|
-
this._publicKey = publicKey;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Serialize this key to JSON-serializable object.
|
|
239
|
-
* @returns {JsonableSecp256k1Identity} JsonableSecp256k1Identity
|
|
240
|
-
*/
|
|
241
|
-
public toJSON(): JsonableSecp256k1Identity {
|
|
242
|
-
return [bytesToHex(this._publicKey.toRaw()), bytesToHex(this._privateKey)];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Return a copy of the key pair.
|
|
247
|
-
* @returns {KeyPair} KeyPair
|
|
248
|
-
*/
|
|
249
|
-
public getKeyPair(): KeyPair {
|
|
250
|
-
return {
|
|
251
|
-
secretKey: this._privateKey,
|
|
252
|
-
publicKey: this._publicKey,
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
* Return the public key.
|
|
258
|
-
* @returns {Required<PublicKey>} Required<PublicKey>
|
|
259
|
-
*/
|
|
260
|
-
public getPublicKey(): Required<PublicKey> {
|
|
261
|
-
return this._publicKey;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Signs a blob of data, with this identity's private key.
|
|
266
|
-
* @param {Uint8Array} data - bytes to hash and sign with this identity's secretKey, producing a signature
|
|
267
|
-
* @returns {Promise<Signature>} signature
|
|
268
|
-
*/
|
|
269
|
-
public async sign(data: Uint8Array): Promise<Signature> {
|
|
270
|
-
const challenge = sha256(data);
|
|
271
|
-
const signature = secp256k1.sign(challenge, this._privateKey).toCompactRawBytes();
|
|
272
|
-
return signature as Signature;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
export default Secp256k1KeyIdentity;
|
package/src/index.ts
DELETED
package/src/principal/index.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JavaScript and TypeScript module to work with Internet Computer Principals.
|
|
3
|
-
*
|
|
4
|
-
* ## Usage
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* import { Principal } from '@icp-sdk/core/principal';
|
|
8
|
-
*
|
|
9
|
-
* const canisterId = Principal.fromText('uqqxf-5h777-77774-qaaaa-cai');
|
|
10
|
-
* const anonymousPrincipal = Principal.anonymous();
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* <!-- split here -->
|
|
14
|
-
* @module libs/principal/api
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export * from './principal.ts';
|
|
18
|
-
export { getCrc32 } from './utils/getCrc.ts';
|
|
19
|
-
export { base32Encode, base32Decode } from './utils/base32.ts';
|