@astrox/principal 0.0.24 → 0.0.30

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.
@@ -0,0 +1,16 @@
1
+ export declare class Principal {
2
+ private _arr;
3
+ static anonymous(): Principal;
4
+ static selfAuthenticating(publicKey: Uint8Array): Principal;
5
+ static from(other: unknown): Principal;
6
+ static fromHex(hex: string): Principal;
7
+ static fromText(text: string): Principal;
8
+ static fromUint8Array(arr: Uint8Array): Principal;
9
+ readonly _isPrincipal = true;
10
+ protected constructor(_arr: Uint8Array);
11
+ isAnonymous(): boolean;
12
+ toUint8Array(): Uint8Array;
13
+ toHex(): string;
14
+ toText(): string;
15
+ toString(): string;
16
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Principal = void 0;
4
+ const base32_1 = require("./utils/base32");
5
+ const getCrc_1 = require("./utils/getCrc");
6
+ const sha224_1 = require("./utils/sha224");
7
+ const SELF_AUTHENTICATING_SUFFIX = 2;
8
+ const ANONYMOUS_SUFFIX = 4;
9
+ const fromHexString = (hexString) => { var _a; return new Uint8Array(((_a = hexString.match(/.{1,2}/g)) !== null && _a !== void 0 ? _a : []).map(byte => parseInt(byte, 16))); };
10
+ const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
11
+ class Principal {
12
+ constructor(_arr) {
13
+ this._arr = _arr;
14
+ this._isPrincipal = true;
15
+ }
16
+ static anonymous() {
17
+ return new this(new Uint8Array([ANONYMOUS_SUFFIX]));
18
+ }
19
+ static selfAuthenticating(publicKey) {
20
+ const sha = sha224_1.sha224(publicKey);
21
+ return new this(new Uint8Array([...sha, SELF_AUTHENTICATING_SUFFIX]));
22
+ }
23
+ static from(other) {
24
+ if (typeof other === 'string') {
25
+ return Principal.fromText(other);
26
+ }
27
+ else if (typeof other === 'object' &&
28
+ other !== null &&
29
+ other._isPrincipal === true) {
30
+ return new Principal(other._arr);
31
+ }
32
+ throw new Error(`Impossible to convert ${JSON.stringify(other)} to Principal.`);
33
+ }
34
+ static fromHex(hex) {
35
+ return new this(fromHexString(hex));
36
+ }
37
+ static fromText(text) {
38
+ const canisterIdNoDash = text.toLowerCase().replace(/-/g, '');
39
+ let arr = base32_1.decode(canisterIdNoDash);
40
+ arr = arr.slice(4, arr.length);
41
+ const principal = new Principal(arr);
42
+ if (principal.toText() !== text) {
43
+ throw new Error(`Principal "${principal.toText()}" does not have a valid checksum.`);
44
+ }
45
+ return principal;
46
+ }
47
+ static fromUint8Array(arr) {
48
+ return new this(arr);
49
+ }
50
+ isAnonymous() {
51
+ return this._arr.byteLength === 1 && this._arr[0] === ANONYMOUS_SUFFIX;
52
+ }
53
+ toUint8Array() {
54
+ return this._arr;
55
+ }
56
+ toHex() {
57
+ return toHexString(this._arr).toUpperCase();
58
+ }
59
+ toText() {
60
+ const checksumArrayBuf = new ArrayBuffer(4);
61
+ const view = new DataView(checksumArrayBuf);
62
+ view.setUint32(0, getCrc_1.getCrc32(this._arr));
63
+ const checksum = new Uint8Array(checksumArrayBuf);
64
+ const bytes = Uint8Array.from(this._arr);
65
+ const array = Uint8Array.from(Array.from(checksum).concat(Array.from(bytes)));
66
+ const result = base32_1.encode(array);
67
+ const matches = result.match(/.{1,5}/g);
68
+ if (!matches) {
69
+ // This should only happen if there's no character, which is unreachable.
70
+ throw new Error();
71
+ }
72
+ return matches.join('-');
73
+ }
74
+ toString() {
75
+ return this.toText();
76
+ }
77
+ }
78
+ exports.Principal = Principal;
79
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAAgD;AAChD,2CAA0C;AAC1C,2CAAwC;AAExC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAE3B,MAAM,aAAa,GAAG,CAAC,SAAiB,E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AAQ,CAAC,gBAAgB,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,iBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,gBAAgB,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,eAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,EAAE;YACZ,yEAAyE;YACzE,MAAM,IAAI,KAAK,EAAE,CAAC;SACnB;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CACF;AAjFD,8BAiFC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @param input The input array to encode.
3
+ * @returns A Base32 string encoding the input.
4
+ */
5
+ export declare function encode(input: Uint8Array): string;
6
+ /**
7
+ * @param input The base32 encoded string to decode.
8
+ */
9
+ export declare function decode(input: string): Uint8Array;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decode = exports.encode = void 0;
4
+ // tslint:disable:no-bitwise
5
+ const alphabet = 'abcdefghijklmnopqrstuvwxyz234567';
6
+ // Build a lookup table for decoding.
7
+ const lookupTable = Object.create(null);
8
+ for (let i = 0; i < alphabet.length; i++) {
9
+ lookupTable[alphabet[i]] = i;
10
+ }
11
+ // Add aliases for rfc4648.
12
+ lookupTable['0'] = lookupTable.o;
13
+ lookupTable['1'] = lookupTable.i;
14
+ /**
15
+ * @param input The input array to encode.
16
+ * @returns A Base32 string encoding the input.
17
+ */
18
+ function encode(input) {
19
+ // How many bits will we skip from the first byte.
20
+ let skip = 0;
21
+ // 5 high bits, carry from one byte to the next.
22
+ let bits = 0;
23
+ // The output string in base32.
24
+ let output = '';
25
+ function encodeByte(byte) {
26
+ if (skip < 0) {
27
+ // we have a carry from the previous byte
28
+ bits |= byte >> -skip;
29
+ }
30
+ else {
31
+ // no carry
32
+ bits = (byte << skip) & 248;
33
+ }
34
+ if (skip > 3) {
35
+ // Not enough data to produce a character, get us another one
36
+ skip -= 8;
37
+ return 1;
38
+ }
39
+ if (skip < 4) {
40
+ // produce a character
41
+ output += alphabet[bits >> 3];
42
+ skip += 5;
43
+ }
44
+ return 0;
45
+ }
46
+ for (let i = 0; i < input.length;) {
47
+ i += encodeByte(input[i]);
48
+ }
49
+ return output + (skip < 0 ? alphabet[bits >> 3] : '');
50
+ }
51
+ exports.encode = encode;
52
+ /**
53
+ * @param input The base32 encoded string to decode.
54
+ */
55
+ function decode(input) {
56
+ // how many bits we have from the previous character.
57
+ let skip = 0;
58
+ // current byte we're producing.
59
+ let byte = 0;
60
+ const output = new Uint8Array(((input.length * 4) / 3) | 0);
61
+ let o = 0;
62
+ function decodeChar(char) {
63
+ // Consume a character from the stream, store
64
+ // the output in this.output. As before, better
65
+ // to use update().
66
+ let val = lookupTable[char.toLowerCase()];
67
+ if (val === undefined) {
68
+ throw new Error(`Invalid character: ${JSON.stringify(char)}`);
69
+ }
70
+ // move to the high bits
71
+ val <<= 3;
72
+ byte |= val >>> skip;
73
+ skip += 5;
74
+ if (skip >= 8) {
75
+ // We have enough bytes to produce an output
76
+ output[o++] = byte;
77
+ skip -= 8;
78
+ if (skip > 0) {
79
+ byte = (val << (5 - skip)) & 255;
80
+ }
81
+ else {
82
+ byte = 0;
83
+ }
84
+ }
85
+ }
86
+ for (const c of input) {
87
+ decodeChar(c);
88
+ }
89
+ return output.slice(0, o);
90
+ }
91
+ exports.decode = decode;
92
+ //# sourceMappingURL=base32.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base32.js","sourceRoot":"","sources":["../../../src/utils/base32.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,MAAM,QAAQ,GAAG,kCAAkC,CAAC;AAEpD,qCAAqC;AACrC,MAAM,WAAW,GAA2B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACxC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAC9B;AAED,2BAA2B;AAC3B,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;AACjC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;AAEjC;;;GAGG;AACH,SAAgB,MAAM,CAAC,KAAiB;IACtC,kDAAkD;IAClD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,gDAAgD;IAChD,IAAI,IAAI,GAAG,CAAC,CAAC;IAEb,+BAA+B;IAC/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,SAAS,UAAU,CAAC,IAAY;QAC9B,IAAI,IAAI,GAAG,CAAC,EAAE;YACZ,yCAAyC;YACzC,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;SACvB;aAAM;YACL,WAAW;YACX,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC;SAC7B;QAED,IAAI,IAAI,GAAG,CAAC,EAAE;YACZ,6DAA6D;YAC7D,IAAI,IAAI,CAAC,CAAC;YACV,OAAO,CAAC,CAAC;SACV;QAED,IAAI,IAAI,GAAG,CAAC,EAAE;YACZ,sBAAsB;Y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,EAAE,CAAC,GAAG,IAAI,CAAC;YACnB,IAAI,IAAI,CAAC,CAAC;YAEV,IAAI,IAAI,GAAG,CAAC,EAAE;gBACZ,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;aAClC;iBAAM;gBACL,IAAI,GAAG,CAAC,CAAC;aACV;SACF;IACH,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;QACrB,UAAU,CAAC,CAAC,CAAC,CAAC;KACf;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC;AAzCD,wBAyCC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Calculate the CRC32 of an ArrayBufferLike.
3
+ * @param buf The BufferLike to calculate the CRC32 of.
4
+ */
5
+ export declare function getCrc32(buf: ArrayBufferLike): number;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ // tslint:disable:no-bitwise
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.getCrc32 = void 0;
5
+ // This file is translated to JavaScript from
6
+ // https://lxp32.github.io/docs/a-simple-example-crc32-calculation/
7
+ const lookUpTable = new Uint32Array([
8
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
9
+ 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
10
+ 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
11
+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
12
+ 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
13
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
14
+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
15
+ 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
16
+ 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
17
+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
18
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
19
+ 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
20
+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
21
+ 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
22
+ 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
23
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
24
+ 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
25
+ 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
26
+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
27
+ 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
28
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
29
+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
30
+ 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
31
+ 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
32
+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
33
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
34
+ 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
35
+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
36
+ 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
37
+ 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
38
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
39
+ 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
40
+ ]);
41
+ /**
42
+ * Calculate the CRC32 of an ArrayBufferLike.
43
+ * @param buf The BufferLike to calculate the CRC32 of.
44
+ */
45
+ function getCrc32(buf) {
46
+ const b = new Uint8Array(buf);
47
+ let crc = -1;
48
+ // tslint:disable-next-line:prefer-for-of
49
+ for (let i = 0; i < b.length; i++) {
50
+ const byte = b[i];
51
+ const t = (byte ^ crc) & 0xff;
52
+ crc = lookUpTable[t] ^ (crc >>> 8);
53
+ }
54
+ return (crc ^ -1) >>> 0;
55
+ }
56
+ exports.getCrc32 = getCrc32;
57
+ //# sourceMappingURL=getCrc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCrc.js","sourceRoot":"","sources":["../../../src/utils/getCrc.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;AAE5B,6CAA6C;AAC7C,mEAAmE;AACnE,MAAM,WAAW,GAAgB,IAAI,WAAW,CAAC;IAC/C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EA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UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/F,CAAC,CAAC;AAEH;;;GAGG;AACH,SAAgB,QAAQ,CAAC,GAAoB;IAC3C,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;IAEb,yCAAyC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACjC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;QAC9B,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;KACpC;IAED,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAZD,4BAYC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns the SHA224 hash of the buffer.
3
+ * @param data Arraybuffer to encode
4
+ */
5
+ export declare function sha224(data: ArrayBuffer): Uint8Array;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sha224 = void 0;
4
+ const js_sha256_1 = require("js-sha256");
5
+ /**
6
+ * Returns the SHA224 hash of the buffer.
7
+ * @param data Arraybuffer to encode
8
+ */
9
+ function sha224(data) {
10
+ const shaObj = js_sha256_1.sha224.create();
11
+ shaObj.update(data);
12
+ return new Uint8Array(shaObj.array());
13
+ }
14
+ exports.sha224 = sha224;
15
+ //# sourceMappingURL=sha224.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha224.js","sourceRoot":"","sources":["../../../src/utils/sha224.ts"],"names":[],"mappings":";;;AAAA,yCAA+C;AAE/C;;;GAGG;AACH,SAAgB,MAAM,CAAC,IAAiB;IACtC,MAAM,MAAM,GAAG,kBAAQ,CAAC,MAAM,EAAE,CAAC;IACjC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AACxC,CAAC;AAJD,wBAIC"}
@@ -0,0 +1,16 @@
1
+ export declare class Principal {
2
+ private _arr;
3
+ static anonymous(): Principal;
4
+ static selfAuthenticating(publicKey: Uint8Array): Principal;
5
+ static from(other: unknown): Principal;
6
+ static fromHex(hex: string): Principal;
7
+ static fromText(text: string): Principal;
8
+ static fromUint8Array(arr: Uint8Array): Principal;
9
+ readonly _isPrincipal = true;
10
+ protected constructor(_arr: Uint8Array);
11
+ isAnonymous(): boolean;
12
+ toUint8Array(): Uint8Array;
13
+ toHex(): string;
14
+ toText(): string;
15
+ toString(): string;
16
+ }
@@ -0,0 +1,75 @@
1
+ import { decode, encode } from './utils/base32';
2
+ import { getCrc32 } from './utils/getCrc';
3
+ import { sha224 } from './utils/sha224';
4
+ const SELF_AUTHENTICATING_SUFFIX = 2;
5
+ const ANONYMOUS_SUFFIX = 4;
6
+ const fromHexString = (hexString) => { var _a; return new Uint8Array(((_a = hexString.match(/.{1,2}/g)) !== null && _a !== void 0 ? _a : []).map(byte => parseInt(byte, 16))); };
7
+ const toHexString = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');
8
+ export class Principal {
9
+ constructor(_arr) {
10
+ this._arr = _arr;
11
+ this._isPrincipal = true;
12
+ }
13
+ static anonymous() {
14
+ return new this(new Uint8Array([ANONYMOUS_SUFFIX]));
15
+ }
16
+ static selfAuthenticating(publicKey) {
17
+ const sha = sha224(publicKey);
18
+ return new this(new Uint8Array([...sha, SELF_AUTHENTICATING_SUFFIX]));
19
+ }
20
+ static from(other) {
21
+ if (typeof other === 'string') {
22
+ return Principal.fromText(other);
23
+ }
24
+ else if (typeof other === 'object' &&
25
+ other !== null &&
26
+ other._isPrincipal === true) {
27
+ return new Principal(other._arr);
28
+ }
29
+ throw new Error(`Impossible to convert ${JSON.stringify(other)} to Principal.`);
30
+ }
31
+ static fromHex(hex) {
32
+ return new this(fromHexString(hex));
33
+ }
34
+ static fromText(text) {
35
+ const canisterIdNoDash = text.toLowerCase().replace(/-/g, '');
36
+ let arr = decode(canisterIdNoDash);
37
+ arr = arr.slice(4, arr.length);
38
+ const principal = new Principal(arr);
39
+ if (principal.toText() !== text) {
40
+ throw new Error(`Principal "${principal.toText()}" does not have a valid checksum.`);
41
+ }
42
+ return principal;
43
+ }
44
+ static fromUint8Array(arr) {
45
+ return new this(arr);
46
+ }
47
+ isAnonymous() {
48
+ return this._arr.byteLength === 1 && this._arr[0] === ANONYMOUS_SUFFIX;
49
+ }
50
+ toUint8Array() {
51
+ return this._arr;
52
+ }
53
+ toHex() {
54
+ return toHexString(this._arr).toUpperCase();
55
+ }
56
+ toText() {
57
+ const checksumArrayBuf = new ArrayBuffer(4);
58
+ const view = new DataView(checksumArrayBuf);
59
+ view.setUint32(0, getCrc32(this._arr));
60
+ const checksum = new Uint8Array(checksumArrayBuf);
61
+ const bytes = Uint8Array.from(this._arr);
62
+ const array = Uint8Array.from(Array.from(checksum).concat(Array.from(bytes)));
63
+ const result = encode(array);
64
+ const matches = result.match(/.{1,5}/g);
65
+ if (!matches) {
66
+ // This should only happen if there's no character, which is unreachable.
67
+ throw new Error();
68
+ }
69
+ return matches.join('-');
70
+ }
71
+ toString() {
72
+ return this.toText();
73
+ }
74
+ }
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE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EM,YAAY;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAEM,KAAK;QACV,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9C,CAAC;IAEM,MAAM;QACX,MAAM,gBAAgB,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;QAE5C,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QAC5C,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,gBAAgB,CAAC,CAAC;QAClD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9E,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAExC,IAAI,CAAC,OAAO,EAAE;YACZ,yEAAyE;YACzE,MAAM,IAAI,KAAK,EAAE,CAAC;SACnB;QACD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @param input The input array to encode.
3
+ * @returns A Base32 string encoding the input.
4
+ */
5
+ export declare function encode(input: Uint8Array): string;
6
+ /**
7
+ * @param input The base32 encoded string to decode.
8
+ */
9
+ export declare function decode(input: string): Uint8Array;
@@ -0,0 +1,87 @@
1
+ // tslint:disable:no-bitwise
2
+ const alphabet = 'abcdefghijklmnopqrstuvwxyz234567';
3
+ // Build a lookup table for decoding.
4
+ const lookupTable = Object.create(null);
5
+ for (let i = 0; i < alphabet.length; i++) {
6
+ lookupTable[alphabet[i]] = i;
7
+ }
8
+ // Add aliases for rfc4648.
9
+ lookupTable['0'] = lookupTable.o;
10
+ lookupTable['1'] = lookupTable.i;
11
+ /**
12
+ * @param input The input array to encode.
13
+ * @returns A Base32 string encoding the input.
14
+ */
15
+ export function encode(input) {
16
+ // How many bits will we skip from the first byte.
17
+ let skip = 0;
18
+ // 5 high bits, carry from one byte to the next.
19
+ let bits = 0;
20
+ // The output string in base32.
21
+ let output = '';
22
+ function encodeByte(byte) {
23
+ if (skip < 0) {
24
+ // we have a carry from the previous byte
25
+ bits |= byte >> -skip;
26
+ }
27
+ else {
28
+ // no carry
29
+ bits = (byte << skip) & 248;
30
+ }
31
+ if (skip > 3) {
32
+ // Not enough data to produce a character, get us another one
33
+ skip -= 8;
34
+ return 1;
35
+ }
36
+ if (skip < 4) {
37
+ // produce a character
38
+ output += alphabet[bits >> 3];
39
+ skip += 5;
40
+ }
41
+ return 0;
42
+ }
43
+ for (let i = 0; i < input.length;) {
44
+ i += encodeByte(input[i]);
45
+ }
46
+ return output + (skip < 0 ? alphabet[bits >> 3] : '');
47
+ }
48
+ /**
49
+ * @param input The base32 encoded string to decode.
50
+ */
51
+ export function decode(input) {
52
+ // how many bits we have from the previous character.
53
+ let skip = 0;
54
+ // current byte we're producing.
55
+ let byte = 0;
56
+ const output = new Uint8Array(((input.length * 4) / 3) | 0);
57
+ let o = 0;
58
+ function decodeChar(char) {
59
+ // Consume a character from the stream, store
60
+ // the output in this.output. As before, better
61
+ // to use update().
62
+ let val = lookupTable[char.toLowerCase()];
63
+ if (val === undefined) {
64
+ throw new Error(`Invalid character: ${JSON.stringify(char)}`);
65
+ }
66
+ // move to the high bits
67
+ val <<= 3;
68
+ byte |= val >>> skip;
69
+ skip += 5;
70
+ if (skip >= 8) {
71
+ // We have enough bytes to produce an output
72
+ output[o++] = byte;
73
+ skip -= 8;
74
+ if (skip > 0) {
75
+ byte = (val << (5 - skip)) & 255;
76
+ }
77
+ else {
78
+ byte = 0;
79
+ }
80
+ }
81
+ }
82
+ for (const c of input) {
83
+ decodeChar(c);
84
+ }
85
+ return output.slice(0, o);
86
+ }
87
+ //# sourceMappingURL=base32.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base32.js","sourceRoot":"","sources":["../../../src/utils/base32.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,MAAM,QAAQ,GAAG,kCAAkC,CAAC;AAEpD,qCAAqC;AACrC,MAAM,WAAW,GAA2B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;IACxC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;CAC9B;AAED,2BAA2B;AAC3B,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;AACjC,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC;AAEjC;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,KAAiB;IACtC,kDAAkD;IAClD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,gDAAgD;IAChD,IAAI,IAAI,GAAG,CAAC,CAAC;IAEb,+BAA+B;IAC/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,SAAS,UAAU,CAAC,IAAY;QAC9B,IAAI,IAAI,GAAG,CAAC,EAAE;YACZ,yCAAyC;YACzC,IAAI,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC;SACvB;aAAM;YACL,WAAW;YACX,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC;SAC7B;QAED,IAAI,IAAI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AAI,GAAG,KAAK,IAAI,CAAC;QACrB,IAAI,IAAI,CAAC,CAAC;QAEV,IAAI,IAAI,IAAI,CAAC,EAAE;YACb,4CAA4C;YAC5C,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC;YACnB,IAAI,IAAI,CAAC,CAAC;YAEV,IAAI,IAAI,GAAG,CAAC,EAAE;gBACZ,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;aAClC;iBAAM;gBACL,IAAI,GAAG,CAAC,CAAC;aACV;SACF;IACH,CAAC;IAED,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE;QACrB,UAAU,CAAC,CAAC,CAAC,CAAC;KACf;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Calculate the CRC32 of an ArrayBufferLike.
3
+ * @param buf The BufferLike to calculate the CRC32 of.
4
+ */
5
+ export declare function getCrc32(buf: ArrayBufferLike): number;
@@ -0,0 +1,53 @@
1
+ // tslint:disable:no-bitwise
2
+ // This file is translated to JavaScript from
3
+ // https://lxp32.github.io/docs/a-simple-example-crc32-calculation/
4
+ const lookUpTable = new Uint32Array([
5
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
6
+ 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
7
+ 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
8
+ 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
9
+ 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
10
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
11
+ 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
12
+ 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
13
+ 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
14
+ 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
15
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
16
+ 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
17
+ 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
18
+ 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
19
+ 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
20
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
21
+ 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
22
+ 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
23
+ 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
24
+ 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
25
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
26
+ 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
27
+ 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
28
+ 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
29
+ 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
30
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
31
+ 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
32
+ 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
33
+ 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
34
+ 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
35
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
36
+ 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
37
+ ]);
38
+ /**
39
+ * Calculate the CRC32 of an ArrayBufferLike.
40
+ * @param buf The BufferLike to calculate the CRC32 of.
41
+ */
42
+ export function getCrc32(buf) {
43
+ const b = new Uint8Array(buf);
44
+ let crc = -1;
45
+ // tslint:disable-next-line:prefer-for-of
46
+ for (let i = 0; i < b.length; i++) {
47
+ const byte = b[i];
48
+ const t = (byte ^ crc) & 0xff;
49
+ crc = lookUpTable[t] ^ (crc >>> 8);
50
+ }
51
+ return (crc ^ -1) >>> 0;
52
+ }
53
+ //# sourceMappingURL=getCrc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getCrc.js","sourceRoot":"","sources":["../../../src/utils/getCrc.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAE5B,6CAA6C;AAC7C,mEAAmE;AACnE,MAAM,WAAW,GAAgB,IAAI,WAAW,CAAC;IAC/C,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE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AU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;CAC/F,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAoB;IAC3C,MAAM,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;IAC9B,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC;IAEb,yCAAyC;IACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACjC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;QAC9B,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;KACpC;IAED,OAAO,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns the SHA224 hash of the buffer.
3
+ * @param data Arraybuffer to encode
4
+ */
5
+ export declare function sha224(data: ArrayBuffer): Uint8Array;
@@ -0,0 +1,11 @@
1
+ import { sha224 as jsSha224 } from 'js-sha256';
2
+ /**
3
+ * Returns the SHA224 hash of the buffer.
4
+ * @param data Arraybuffer to encode
5
+ */
6
+ export function sha224(data) {
7
+ const shaObj = jsSha224.create();
8
+ shaObj.update(data);
9
+ return new Uint8Array(shaObj.array());
10
+ }
11
+ //# sourceMappingURL=sha224.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha224.js","sourceRoot":"","sources":["../../../src/utils/sha224.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,MAAM,CAAC,IAAiB;IACtC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;IACjC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;AACxC,CAAC"}