@textrp/briij-js-sdk 42.0.0 → 43.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.
@@ -0,0 +1,24 @@
1
+ import { type WalletE2eeRecoveryEnvelope } from "./@types/auth.ts";
2
+ export interface CreateDualWrapEnvelopeParams {
3
+ chainId: string;
4
+ accountId: string;
5
+ backupPassword: string;
6
+ walletWrapKey: Uint8Array;
7
+ createdAtMs?: number;
8
+ keyId?: string;
9
+ recoveryKey?: Uint8Array;
10
+ }
11
+ export interface UnwrapWithWalletParams {
12
+ envelope: WalletE2eeRecoveryEnvelope;
13
+ walletWrapKey: Uint8Array;
14
+ }
15
+ export interface UnwrapWithPasswordParams {
16
+ envelope: WalletE2eeRecoveryEnvelope;
17
+ backupPassword: string;
18
+ }
19
+ export declare function deriveWalletWrapKeyFromSecret(walletSecret: string, chainId: string, accountId: string, homeserver: string): Promise<Uint8Array>;
20
+ export declare function validateRecoveryEnvelopeShape(value: unknown): asserts value is WalletE2eeRecoveryEnvelope;
21
+ export declare function createDualWrapEnvelope(params: CreateDualWrapEnvelopeParams): Promise<WalletE2eeRecoveryEnvelope>;
22
+ export declare function unwrapWithWallet({ envelope, walletWrapKey }: UnwrapWithWalletParams): Promise<Uint8Array>;
23
+ export declare function unwrapWithPassword({ envelope, backupPassword, }: UnwrapWithPasswordParams): Promise<Uint8Array>;
24
+ //# sourceMappingURL=wallet-recovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-recovery.d.ts","sourceRoot":"","sources":["../src/wallet-recovery.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,KAAK,0BAA0B,EAA2B,MAAM,kBAAkB,CAAC;AAQ5F,MAAM,WAAW,4BAA4B;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,UAAU,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACnC,QAAQ,EAAE,0BAA0B,CAAC;IACrC,aAAa,EAAE,UAAU,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACrC,QAAQ,EAAE,0BAA0B,CAAC;IACrC,cAAc,EAAE,MAAM,CAAC;CAC1B;AAuHD,wBAAsB,6BAA6B,CAC/C,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACnB,OAAO,CAAC,UAAU,CAAC,CAOrB;AAED,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,OAAO,GACf,OAAO,CAAC,KAAK,IAAI,0BAA0B,CAiB7C;AAED,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAwCtH;AAED,wBAAsB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,CAG/G;AAED,wBAAsB,kBAAkB,CAAC,EACrC,QAAQ,EACR,cAAc,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC,CAKhD"}
@@ -0,0 +1,232 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ /*
3
+ Copyright 2026 TextRP
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ */
17
+
18
+ var ENVELOPE_VERSION = 1;
19
+ var KEY_BYTES = 32;
20
+ var NONCE_BYTES = 12;
21
+ var SALT_BYTES = 16;
22
+ var PASSWORD_KDF_ITERATIONS = 210000;
23
+ function assert(condition, message) {
24
+ if (!condition) throw new Error(message);
25
+ }
26
+ function toBase64(bytes) {
27
+ if (typeof Buffer !== "undefined") return Buffer.from(bytes).toString("base64");
28
+ var binary = "";
29
+ bytes.forEach(b => binary += String.fromCodePoint(b));
30
+ return btoa(binary);
31
+ }
32
+ function fromBase64(value) {
33
+ if (typeof Buffer !== "undefined") return new Uint8Array(Buffer.from(value, "base64"));
34
+ var binary = atob(value);
35
+ var out = new Uint8Array(binary.length);
36
+ for (var i = 0; i < binary.length; i++) out[i] = binary.codePointAt(i);
37
+ return out;
38
+ }
39
+ function toUtf8(value) {
40
+ return new TextEncoder().encode(value);
41
+ }
42
+ function toArrayBuffer(value) {
43
+ return value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength);
44
+ }
45
+ function randomBytes(len) {
46
+ var out = new Uint8Array(len);
47
+ globalThis.crypto.getRandomValues(out);
48
+ return out;
49
+ }
50
+ function importAesGcmKey(_x) {
51
+ return _importAesGcmKey.apply(this, arguments);
52
+ }
53
+ function _importAesGcmKey() {
54
+ _importAesGcmKey = _asyncToGenerator(function* (key) {
55
+ return yield globalThis.crypto.subtle.importKey("raw", toArrayBuffer(key), {
56
+ name: "AES-GCM"
57
+ }, false, ["encrypt", "decrypt"]);
58
+ });
59
+ return _importAesGcmKey.apply(this, arguments);
60
+ }
61
+ function encryptWrap(_x2, _x3) {
62
+ return _encryptWrap.apply(this, arguments);
63
+ }
64
+ function _encryptWrap() {
65
+ _encryptWrap = _asyncToGenerator(function* (plaintext, _ref) {
66
+ var {
67
+ key,
68
+ aad,
69
+ kdf,
70
+ params
71
+ } = _ref;
72
+ assert(key.length >= KEY_BYTES, "wallet recovery key must be at least 32 bytes");
73
+ var salt = randomBytes(SALT_BYTES);
74
+ var nonce = randomBytes(NONCE_BYTES);
75
+ var cryptoKey = yield importAesGcmKey(key.slice(0, KEY_BYTES));
76
+ var ciphertext = yield globalThis.crypto.subtle.encrypt({
77
+ name: "AES-GCM",
78
+ iv: toArrayBuffer(nonce),
79
+ additionalData: toArrayBuffer(aad),
80
+ tagLength: 128
81
+ }, cryptoKey, toArrayBuffer(plaintext));
82
+ return {
83
+ alg: "aes-256-gcm",
84
+ kdf,
85
+ salt: toBase64(salt),
86
+ nonce: toBase64(nonce),
87
+ ciphertext: toBase64(new Uint8Array(ciphertext)),
88
+ aad: toBase64(aad),
89
+ params
90
+ };
91
+ });
92
+ return _encryptWrap.apply(this, arguments);
93
+ }
94
+ function decryptWrap(_x4, _x5) {
95
+ return _decryptWrap.apply(this, arguments);
96
+ }
97
+ function _decryptWrap() {
98
+ _decryptWrap = _asyncToGenerator(function* (wrap, key) {
99
+ var nonce = fromBase64(wrap.nonce);
100
+ var aad = wrap.aad ? fromBase64(wrap.aad) : new Uint8Array();
101
+ var ciphertext = fromBase64(wrap.ciphertext);
102
+ var cryptoKey = yield importAesGcmKey(key.slice(0, KEY_BYTES));
103
+ var plaintext = yield globalThis.crypto.subtle.decrypt({
104
+ name: "AES-GCM",
105
+ iv: toArrayBuffer(nonce),
106
+ additionalData: toArrayBuffer(aad),
107
+ tagLength: 128
108
+ }, cryptoKey, toArrayBuffer(ciphertext));
109
+ return new Uint8Array(plaintext);
110
+ });
111
+ return _decryptWrap.apply(this, arguments);
112
+ }
113
+ function derivePasswordWrapKey(_x6, _x7) {
114
+ return _derivePasswordWrapKey.apply(this, arguments);
115
+ }
116
+ function _derivePasswordWrapKey() {
117
+ _derivePasswordWrapKey = _asyncToGenerator(function* (password, salt) {
118
+ var keyMaterial = yield globalThis.crypto.subtle.importKey("raw", toArrayBuffer(toUtf8(password)), "PBKDF2", false, ["deriveBits"]);
119
+ var bits = yield globalThis.crypto.subtle.deriveBits({
120
+ name: "PBKDF2",
121
+ hash: "SHA-256",
122
+ salt: toArrayBuffer(salt),
123
+ iterations: PASSWORD_KDF_ITERATIONS
124
+ }, keyMaterial, KEY_BYTES * 8);
125
+ return new Uint8Array(bits);
126
+ });
127
+ return _derivePasswordWrapKey.apply(this, arguments);
128
+ }
129
+ export function deriveWalletWrapKeyFromSecret(_x8, _x9, _x0, _x1) {
130
+ return _deriveWalletWrapKeyFromSecret.apply(this, arguments);
131
+ }
132
+ function _deriveWalletWrapKeyFromSecret() {
133
+ _deriveWalletWrapKeyFromSecret = _asyncToGenerator(function* (walletSecret, chainId, accountId, homeserver) {
134
+ var context = "briij-wallet-auth-wrap-v1:".concat(homeserver, ":").concat(chainId, ":").concat(accountId);
135
+ var digest = yield globalThis.crypto.subtle.digest("SHA-256", toArrayBuffer(toUtf8("".concat(context, ":").concat(walletSecret))));
136
+ return new Uint8Array(digest);
137
+ });
138
+ return _deriveWalletWrapKeyFromSecret.apply(this, arguments);
139
+ }
140
+ export function validateRecoveryEnvelopeShape(value) {
141
+ assert(!!value && typeof value === "object", "recovery envelope must be an object");
142
+ var envelope = value;
143
+ assert(typeof envelope.envelope_version === "number", "envelope_version must be a number");
144
+ assert(typeof envelope.chain_id === "string" && envelope.chain_id.length > 0, "chain_id is required");
145
+ assert(typeof envelope.account_id === "string" && envelope.account_id.length > 0, "account_id is required");
146
+ assert(typeof envelope.created_at_ms === "number", "created_at_ms must be a number");
147
+ assert(typeof envelope.key_id === "string" && envelope.key_id.length > 0, "key_id is required");
148
+ assert(!!envelope.wallet_wrap && typeof envelope.wallet_wrap === "object", "wallet_wrap is required");
149
+ assert(!!envelope.password_wrap && typeof envelope.password_wrap === "object", "password_wrap is required");
150
+ for (var wrap of [envelope.wallet_wrap, envelope.password_wrap]) {
151
+ assert(typeof wrap.alg === "string" && wrap.alg.length > 0, "wrap.alg is required");
152
+ assert(typeof wrap.kdf === "string" && wrap.kdf.length > 0, "wrap.kdf is required");
153
+ assert(typeof wrap.salt === "string" && wrap.salt.length > 0, "wrap.salt is required");
154
+ assert(typeof wrap.nonce === "string" && wrap.nonce.length > 0, "wrap.nonce is required");
155
+ assert(typeof wrap.ciphertext === "string" && wrap.ciphertext.length > 0, "wrap.ciphertext is required");
156
+ }
157
+ }
158
+ export function createDualWrapEnvelope(_x10) {
159
+ return _createDualWrapEnvelope.apply(this, arguments);
160
+ }
161
+ function _createDualWrapEnvelope() {
162
+ _createDualWrapEnvelope = _asyncToGenerator(function* (params) {
163
+ var _params$createdAtMs, _params$keyId, _params$recoveryKey;
164
+ assert(params.chainId.length > 0, "chainId is required");
165
+ assert(params.accountId.length > 0, "accountId is required");
166
+ assert(params.backupPassword.length > 0, "backupPassword is required");
167
+ assert(params.walletWrapKey.length >= KEY_BYTES, "walletWrapKey must be at least 32 bytes");
168
+ var createdAtMs = (_params$createdAtMs = params.createdAtMs) !== null && _params$createdAtMs !== void 0 ? _params$createdAtMs : Date.now();
169
+ var keyId = (_params$keyId = params.keyId) !== null && _params$keyId !== void 0 ? _params$keyId : "k-".concat(toBase64(randomBytes(8)).replace(/=+$/g, ""));
170
+ var recoveryKey = (_params$recoveryKey = params.recoveryKey) !== null && _params$recoveryKey !== void 0 ? _params$recoveryKey : randomBytes(KEY_BYTES);
171
+ assert(recoveryKey.length === KEY_BYTES, "recoveryKey must be 32 bytes");
172
+ var aad = toUtf8("briij-recovery-envelope-v1:".concat(params.chainId, ":").concat(params.accountId, ":").concat(keyId, ":").concat(createdAtMs));
173
+ var walletWrap = yield encryptWrap(recoveryKey, {
174
+ key: params.walletWrapKey,
175
+ aad,
176
+ kdf: "sha256-context-v1"
177
+ });
178
+ var passwordSalt = randomBytes(SALT_BYTES);
179
+ var passwordWrapKey = yield derivePasswordWrapKey(params.backupPassword, passwordSalt);
180
+ var passwordWrap = yield encryptWrap(recoveryKey, {
181
+ key: passwordWrapKey,
182
+ aad,
183
+ kdf: "pbkdf2-sha256-v1",
184
+ params: {
185
+ iterations: PASSWORD_KDF_ITERATIONS,
186
+ hash: "SHA-256"
187
+ }
188
+ });
189
+ passwordWrap.salt = toBase64(passwordSalt);
190
+ return {
191
+ envelope_version: ENVELOPE_VERSION,
192
+ chain_id: params.chainId,
193
+ account_id: params.accountId,
194
+ created_at_ms: createdAtMs,
195
+ key_id: keyId,
196
+ wallet_wrap: walletWrap,
197
+ password_wrap: passwordWrap
198
+ };
199
+ });
200
+ return _createDualWrapEnvelope.apply(this, arguments);
201
+ }
202
+ export function unwrapWithWallet(_x11) {
203
+ return _unwrapWithWallet.apply(this, arguments);
204
+ }
205
+ function _unwrapWithWallet() {
206
+ _unwrapWithWallet = _asyncToGenerator(function* (_ref2) {
207
+ var {
208
+ envelope,
209
+ walletWrapKey
210
+ } = _ref2;
211
+ validateRecoveryEnvelopeShape(envelope);
212
+ return yield decryptWrap(envelope.wallet_wrap, walletWrapKey);
213
+ });
214
+ return _unwrapWithWallet.apply(this, arguments);
215
+ }
216
+ export function unwrapWithPassword(_x12) {
217
+ return _unwrapWithPassword.apply(this, arguments);
218
+ }
219
+ function _unwrapWithPassword() {
220
+ _unwrapWithPassword = _asyncToGenerator(function* (_ref3) {
221
+ var {
222
+ envelope,
223
+ backupPassword
224
+ } = _ref3;
225
+ validateRecoveryEnvelopeShape(envelope);
226
+ var passwordSalt = fromBase64(envelope.password_wrap.salt);
227
+ var passwordWrapKey = yield derivePasswordWrapKey(backupPassword, passwordSalt);
228
+ return yield decryptWrap(envelope.password_wrap, passwordWrapKey);
229
+ });
230
+ return _unwrapWithPassword.apply(this, arguments);
231
+ }
232
+ //# sourceMappingURL=wallet-recovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-recovery.js","names":["ENVELOPE_VERSION","KEY_BYTES","NONCE_BYTES","SALT_BYTES","PASSWORD_KDF_ITERATIONS","assert","condition","message","Error","toBase64","bytes","Buffer","from","toString","binary","forEach","b","String","fromCodePoint","btoa","fromBase64","value","Uint8Array","atob","out","length","i","codePointAt","toUtf8","TextEncoder","encode","toArrayBuffer","buffer","slice","byteOffset","byteLength","randomBytes","len","globalThis","crypto","getRandomValues","importAesGcmKey","_x","_importAesGcmKey","apply","arguments","_asyncToGenerator","key","subtle","importKey","name","encryptWrap","_x2","_x3","_encryptWrap","plaintext","_ref","aad","kdf","params","salt","nonce","cryptoKey","ciphertext","encrypt","iv","additionalData","tagLength","alg","decryptWrap","_x4","_x5","_decryptWrap","wrap","decrypt","derivePasswordWrapKey","_x6","_x7","_derivePasswordWrapKey","password","keyMaterial","bits","deriveBits","hash","iterations","deriveWalletWrapKeyFromSecret","_x8","_x9","_x0","_x1","_deriveWalletWrapKeyFromSecret","walletSecret","chainId","accountId","homeserver","context","concat","digest","validateRecoveryEnvelopeShape","envelope","envelope_version","chain_id","account_id","created_at_ms","key_id","wallet_wrap","password_wrap","createDualWrapEnvelope","_x10","_createDualWrapEnvelope","_params$createdAtMs","_params$keyId","_params$recoveryKey","backupPassword","walletWrapKey","createdAtMs","Date","now","keyId","replace","recoveryKey","walletWrap","passwordSalt","passwordWrapKey","passwordWrap","unwrapWithWallet","_x11","_unwrapWithWallet","_ref2","unwrapWithPassword","_x12","_unwrapWithPassword","_ref3"],"sources":["../src/wallet-recovery.ts"],"sourcesContent":["/*\nCopyright 2026 TextRP\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\nimport { type WalletE2eeRecoveryEnvelope, type WalletRecoveryWrap } from \"./@types/auth.ts\";\n\nconst ENVELOPE_VERSION = 1;\nconst KEY_BYTES = 32;\nconst NONCE_BYTES = 12;\nconst SALT_BYTES = 16;\nconst PASSWORD_KDF_ITERATIONS = 210_000;\n\nexport interface CreateDualWrapEnvelopeParams {\n chainId: string;\n accountId: string;\n backupPassword: string;\n walletWrapKey: Uint8Array;\n createdAtMs?: number;\n keyId?: string;\n recoveryKey?: Uint8Array;\n}\n\nexport interface UnwrapWithWalletParams {\n envelope: WalletE2eeRecoveryEnvelope;\n walletWrapKey: Uint8Array;\n}\n\nexport interface UnwrapWithPasswordParams {\n envelope: WalletE2eeRecoveryEnvelope;\n backupPassword: string;\n}\n\nfunction assert(condition: boolean, message: string): asserts condition {\n if (!condition) throw new Error(message);\n}\n\nfunction toBase64(bytes: Uint8Array): string {\n if (typeof Buffer !== \"undefined\") return Buffer.from(bytes).toString(\"base64\");\n let binary = \"\";\n bytes.forEach((b) => (binary += String.fromCodePoint(b)));\n return btoa(binary);\n}\n\nfunction fromBase64(value: string): Uint8Array {\n if (typeof Buffer !== \"undefined\") return new Uint8Array(Buffer.from(value, \"base64\"));\n const binary = atob(value);\n const out = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) out[i] = binary.codePointAt(i)!;\n return out;\n}\n\nfunction toUtf8(value: string): Uint8Array {\n return new TextEncoder().encode(value);\n}\n\nfunction toArrayBuffer(value: Uint8Array): ArrayBuffer {\n return value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength) as ArrayBuffer;\n}\n\nfunction randomBytes(len: number): Uint8Array {\n const out = new Uint8Array(len);\n globalThis.crypto.getRandomValues(out);\n return out;\n}\n\nasync function importAesGcmKey(key: Uint8Array): Promise<CryptoKey> {\n return await globalThis.crypto.subtle.importKey(\n \"raw\",\n toArrayBuffer(key),\n { name: \"AES-GCM\" },\n false,\n [\"encrypt\", \"decrypt\"],\n );\n}\n\nasync function encryptWrap(\n plaintext: Uint8Array,\n {\n key,\n aad,\n kdf,\n params,\n }: {\n key: Uint8Array;\n aad: Uint8Array;\n kdf: string;\n params?: Record<string, unknown>;\n },\n): Promise<WalletRecoveryWrap> {\n assert(key.length >= KEY_BYTES, \"wallet recovery key must be at least 32 bytes\");\n const salt = randomBytes(SALT_BYTES);\n const nonce = randomBytes(NONCE_BYTES);\n const cryptoKey = await importAesGcmKey(key.slice(0, KEY_BYTES));\n const ciphertext = await globalThis.crypto.subtle.encrypt(\n {\n name: \"AES-GCM\",\n iv: toArrayBuffer(nonce),\n additionalData: toArrayBuffer(aad),\n tagLength: 128,\n },\n cryptoKey,\n toArrayBuffer(plaintext),\n );\n return {\n alg: \"aes-256-gcm\",\n kdf,\n salt: toBase64(salt),\n nonce: toBase64(nonce),\n ciphertext: toBase64(new Uint8Array(ciphertext)),\n aad: toBase64(aad),\n params,\n };\n}\n\nasync function decryptWrap(wrap: WalletRecoveryWrap, key: Uint8Array): Promise<Uint8Array> {\n const nonce = fromBase64(wrap.nonce);\n const aad = wrap.aad ? fromBase64(wrap.aad) : new Uint8Array();\n const ciphertext = fromBase64(wrap.ciphertext);\n const cryptoKey = await importAesGcmKey(key.slice(0, KEY_BYTES));\n const plaintext = await globalThis.crypto.subtle.decrypt(\n {\n name: \"AES-GCM\",\n iv: toArrayBuffer(nonce),\n additionalData: toArrayBuffer(aad),\n tagLength: 128,\n },\n cryptoKey,\n toArrayBuffer(ciphertext),\n );\n return new Uint8Array(plaintext);\n}\n\nasync function derivePasswordWrapKey(password: string, salt: Uint8Array): Promise<Uint8Array> {\n const keyMaterial = await globalThis.crypto.subtle.importKey(\"raw\", toArrayBuffer(toUtf8(password)), \"PBKDF2\", false, [\n \"deriveBits\",\n ]);\n const bits = await globalThis.crypto.subtle.deriveBits(\n {\n name: \"PBKDF2\",\n hash: \"SHA-256\",\n salt: toArrayBuffer(salt),\n iterations: PASSWORD_KDF_ITERATIONS,\n },\n keyMaterial,\n KEY_BYTES * 8,\n );\n return new Uint8Array(bits);\n}\n\nexport async function deriveWalletWrapKeyFromSecret(\n walletSecret: string,\n chainId: string,\n accountId: string,\n homeserver: string,\n): Promise<Uint8Array> {\n const context = `briij-wallet-auth-wrap-v1:${homeserver}:${chainId}:${accountId}`;\n const digest = await globalThis.crypto.subtle.digest(\n \"SHA-256\",\n toArrayBuffer(toUtf8(`${context}:${walletSecret}`)),\n );\n return new Uint8Array(digest);\n}\n\nexport function validateRecoveryEnvelopeShape(\n value: unknown,\n): asserts value is WalletE2eeRecoveryEnvelope {\n assert(!!value && typeof value === \"object\", \"recovery envelope must be an object\");\n const envelope = value as WalletE2eeRecoveryEnvelope;\n assert(typeof envelope.envelope_version === \"number\", \"envelope_version must be a number\");\n assert(typeof envelope.chain_id === \"string\" && envelope.chain_id.length > 0, \"chain_id is required\");\n assert(typeof envelope.account_id === \"string\" && envelope.account_id.length > 0, \"account_id is required\");\n assert(typeof envelope.created_at_ms === \"number\", \"created_at_ms must be a number\");\n assert(typeof envelope.key_id === \"string\" && envelope.key_id.length > 0, \"key_id is required\");\n assert(!!envelope.wallet_wrap && typeof envelope.wallet_wrap === \"object\", \"wallet_wrap is required\");\n assert(!!envelope.password_wrap && typeof envelope.password_wrap === \"object\", \"password_wrap is required\");\n for (const wrap of [envelope.wallet_wrap, envelope.password_wrap]) {\n assert(typeof wrap.alg === \"string\" && wrap.alg.length > 0, \"wrap.alg is required\");\n assert(typeof wrap.kdf === \"string\" && wrap.kdf.length > 0, \"wrap.kdf is required\");\n assert(typeof wrap.salt === \"string\" && wrap.salt.length > 0, \"wrap.salt is required\");\n assert(typeof wrap.nonce === \"string\" && wrap.nonce.length > 0, \"wrap.nonce is required\");\n assert(typeof wrap.ciphertext === \"string\" && wrap.ciphertext.length > 0, \"wrap.ciphertext is required\");\n }\n}\n\nexport async function createDualWrapEnvelope(params: CreateDualWrapEnvelopeParams): Promise<WalletE2eeRecoveryEnvelope> {\n assert(params.chainId.length > 0, \"chainId is required\");\n assert(params.accountId.length > 0, \"accountId is required\");\n assert(params.backupPassword.length > 0, \"backupPassword is required\");\n assert(params.walletWrapKey.length >= KEY_BYTES, \"walletWrapKey must be at least 32 bytes\");\n\n const createdAtMs = params.createdAtMs ?? Date.now();\n const keyId = params.keyId ?? `k-${toBase64(randomBytes(8)).replace(/=+$/g, \"\")}`;\n const recoveryKey = params.recoveryKey ?? randomBytes(KEY_BYTES);\n assert(recoveryKey.length === KEY_BYTES, \"recoveryKey must be 32 bytes\");\n\n const aad = toUtf8(`briij-recovery-envelope-v1:${params.chainId}:${params.accountId}:${keyId}:${createdAtMs}`);\n const walletWrap = await encryptWrap(recoveryKey, {\n key: params.walletWrapKey,\n aad,\n kdf: \"sha256-context-v1\",\n });\n\n const passwordSalt = randomBytes(SALT_BYTES);\n const passwordWrapKey = await derivePasswordWrapKey(params.backupPassword, passwordSalt);\n const passwordWrap = await encryptWrap(recoveryKey, {\n key: passwordWrapKey,\n aad,\n kdf: \"pbkdf2-sha256-v1\",\n params: {\n iterations: PASSWORD_KDF_ITERATIONS,\n hash: \"SHA-256\",\n },\n });\n passwordWrap.salt = toBase64(passwordSalt);\n\n return {\n envelope_version: ENVELOPE_VERSION,\n chain_id: params.chainId,\n account_id: params.accountId,\n created_at_ms: createdAtMs,\n key_id: keyId,\n wallet_wrap: walletWrap,\n password_wrap: passwordWrap,\n };\n}\n\nexport async function unwrapWithWallet({ envelope, walletWrapKey }: UnwrapWithWalletParams): Promise<Uint8Array> {\n validateRecoveryEnvelopeShape(envelope);\n return await decryptWrap(envelope.wallet_wrap, walletWrapKey);\n}\n\nexport async function unwrapWithPassword({\n envelope,\n backupPassword,\n}: UnwrapWithPasswordParams): Promise<Uint8Array> {\n validateRecoveryEnvelopeShape(envelope);\n const passwordSalt = fromBase64(envelope.password_wrap.salt);\n const passwordWrapKey = await derivePasswordWrapKey(backupPassword, passwordSalt);\n return await decryptWrap(envelope.password_wrap, passwordWrapKey);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,IAAMA,gBAAgB,GAAG,CAAC;AAC1B,IAAMC,SAAS,GAAG,EAAE;AACpB,IAAMC,WAAW,GAAG,EAAE;AACtB,IAAMC,UAAU,GAAG,EAAE;AACrB,IAAMC,uBAAuB,GAAG,MAAO;AAsBvC,SAASC,MAAMA,CAACC,SAAkB,EAAEC,OAAe,E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,GAAAmB,KAAA;IACvBlC,6BAA6B,CAACC,QAAQ,CAAC;IACvC,IAAMuB,YAAY,GAAGtG,UAAU,CAAC+E,QAAQ,CAACO,aAAa,CAAC9C,IAAI,CAAC;IAC5D,IAAM+D,eAAe,SAAShD,qBAAqB,CAACsC,cAAc,EAAES,YAAY,CAAC;IACjF,aAAarD,WAAW,CAAC8B,QAAQ,CAACO,aAAa,EAAEiB,eAAe,CAAC;EACrE,CAAC;EAAA,OAAAQ,mBAAA,CAAAvF,KAAA,OAAAC,SAAA;AAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,128 +1,130 @@
1
1
  {
2
- "name": "@textrp/briij-js-sdk",
3
- "version": "42.0.0",
4
- "description": "Briij Client-Server SDK for JavaScript and TypeScript",
5
- "engines": {
6
- "node": ">=22.0.0"
7
- },
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/xurgedigitallab/briij-js-sdk.git"
11
- },
12
- "keywords": [
13
- "briij"
14
- ],
15
- "type": "module",
16
- "main": "./lib/index.js",
17
- "browser": "./lib/browser-index.js",
18
- "typings": "./lib/index.d.ts",
19
- "author": "textrp",
20
- "license": "Apache-2.0",
21
- "publishConfig": {
22
- "registry": "https://registry.npmjs.org",
23
- "access": "public"
24
- },
25
- "files": [
26
- "lib",
27
- "src",
28
- "git-revision.txt",
29
- "CHANGELOG.md",
30
- "CONTRIBUTING.rst",
31
- "LICENSE",
32
- "README.md",
33
- "package.json",
34
- "release.sh"
35
- ],
36
- "dependencies": {
37
- "@babel/runtime": "^7.12.5",
38
- "@matrix-org/matrix-sdk-crypto-wasm": "^17.1.0",
39
- "another-json": "^0.2.0",
40
- "bs58": "^6.0.0",
41
- "content-type": "^1.0.4",
42
- "jwt-decode": "^4.0.0",
43
- "loglevel": "^1.9.2",
44
- "matrix-events-sdk": "0.0.1",
45
- "matrix-widget-api": "^1.16.1",
46
- "oidc-client-ts": "^3.0.1",
47
- "p-retry": "7",
48
- "sdp-transform": "^3.0.0",
49
- "unhomoglyph": "^1.0.6",
50
- "uuid": "13",
51
- "xrpl": "^4.6.0"
52
- },
53
- "devDependencies": {
54
- "@action-validator/cli": "^0.6.0",
55
- "@action-validator/core": "^0.6.0",
56
- "@babel/cli": "^7.12.10",
57
- "@babel/core": "^7.12.10",
58
- "@babel/eslint-parser": "^7.12.10",
59
- "@babel/eslint-plugin": "^7.12.10",
60
- "@babel/plugin-proposal-decorators": "^7.25.9",
61
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
62
- "@babel/plugin-transform-class-properties": "^7.12.1",
63
- "@babel/plugin-transform-numeric-separator": "^7.12.7",
64
- "@babel/plugin-transform-object-rest-spread": "^7.12.1",
65
- "@babel/plugin-transform-runtime": "^7.12.10",
66
- "@babel/preset-env": "^7.12.11",
67
- "@babel/preset-typescript": "^7.12.7",
68
- "@fetch-mock/vitest": "^0.2.18",
69
- "@matrix-org/olm": "3.2.15",
70
- "@peculiar/webcrypto": "^1.4.5",
71
- "@stylistic/eslint-plugin": "^5.0.0",
72
- "@types/content-type": "^1.1.5",
73
- "@types/debug": "^4.1.7",
74
- "@types/node": "22",
75
- "@types/sdp-transform": "^2.4.5",
76
- "@typescript-eslint/eslint-plugin": "^8.0.0",
77
- "@typescript-eslint/parser": "^8.0.0",
78
- "@vitest/coverage-v8": "^4.0.17",
79
- "@vitest/eslint-plugin": "^1.6.6",
80
- "@vitest/ui": "^4.0.17",
81
- "babel-plugin-search-and-replace": "^1.1.1",
82
- "debug": "^4.3.4",
83
- "eslint": "^9.0.0",
84
- "eslint-config-google": "^0.14.0",
85
- "eslint-config-prettier": "^10.0.0",
86
- "eslint-import-resolver-typescript": "^4.0.0",
87
- "eslint-plugin-import": "^2.26.0",
88
- "eslint-plugin-jsdoc": "^62.0.0",
89
- "eslint-plugin-matrix-org": "^3.0.0",
90
- "eslint-plugin-n": "^14.0.0",
91
- "eslint-plugin-tsdoc": "^0.5.0",
92
- "eslint-plugin-unicorn": "^56.0.0",
93
- "fake-indexeddb": "^5.0.2",
94
- "fetch-mock": "^12.6.0",
95
- "happy-dom": "^20.1.0",
96
- "husky": "^9.0.0",
97
- "knip": "^5.0.0",
98
- "lint-staged": "^16.0.0",
99
- "matrix-mock-request": "^2.5.0",
100
- "prettier": "3.8.1",
101
- "typedoc": "^0.28.1",
102
- "typedoc-plugin-coverage": "^4.0.0",
103
- "typedoc-plugin-mdn-links": "^5.0.0",
104
- "typedoc-plugin-missing-exports": "^4.0.0",
105
- "typescript": "^5.4.2",
106
- "vitest": "^4.0.17",
107
- "vitest-sonar-reporter": "^3.0.0"
108
- },
109
- "resolutions": {
110
- "expect": "30.2.0"
111
- },
112
- "scripts": {
113
- "start": "echo THIS IS FOR LEGACY PURPOSES ONLY. && babel --delete-dir-on-start src -w -s -d lib --verbose --extensions \".ts,.js\"",
114
- "build": "pnpm build:compile && pnpm build:types",
115
- "build:types": "tsc -p tsconfig-build.json --emitDeclarationOnly",
116
- "build:compile": "babel --delete-dir-on-start -d lib --verbose --extensions \".ts,.js\" src",
117
- "gendoc": "typedoc",
118
- "lint": "pnpm lint:types && pnpm lint:js && pnpm lint:workflows",
119
- "lint:js": "eslint --max-warnings 0 src spec && prettier --check .",
120
- "lint:js-fix": "prettier --log-level=warn --write . && eslint --fix src spec",
121
- "lint:types": "tsc --noEmit",
122
- "lint:workflows": "find .github/workflows -type f \\( -iname '*.yaml' -o -iname '*.yml' \\) | xargs -I {} sh -c 'echo \"Linting {}\"; action-validator \"{}\"'",
123
- "lint:knip": "knip",
124
- "test": "vitest",
125
- "test:watch": "vitest --watch",
126
- "coverage": "pnpm test --coverage"
127
- }
128
- }
2
+ "name": "@textrp/briij-js-sdk",
3
+ "version": "43.0.0",
4
+ "description": "Briij Client-Server SDK for JavaScript and TypeScript",
5
+ "engines": {
6
+ "node": ">=22.0.0"
7
+ },
8
+ "scripts": {
9
+ "prepare": "pnpm build",
10
+ "start": "echo THIS IS FOR LEGACY PURPOSES ONLY. && babel --delete-dir-on-start src -w -s -d lib --verbose --extensions \".ts,.js\"",
11
+ "build": "pnpm build:compile && pnpm build:types",
12
+ "build:types": "tsc -p tsconfig-build.json --emitDeclarationOnly",
13
+ "build:compile": "babel --delete-dir-on-start -d lib --verbose --extensions \".ts,.js\" src",
14
+ "gendoc": "typedoc",
15
+ "lint": "pnpm lint:types && pnpm lint:js && pnpm lint:workflows",
16
+ "lint:js": "eslint --max-warnings 0 src spec && prettier --check .",
17
+ "lint:js-fix": "prettier --log-level=warn --write . && eslint --fix src spec",
18
+ "lint:types": "tsc --noEmit",
19
+ "lint:workflows": "find .github/workflows -type f \\( -iname '*.yaml' -o -iname '*.yml' \\) | xargs -I {} sh -c 'echo \"Linting {}\"; action-validator \"{}\"'",
20
+ "lint:knip": "knip",
21
+ "test": "vitest",
22
+ "test:watch": "vitest --watch",
23
+ "coverage": "pnpm test --coverage"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/xurgedigitallab/briij-js-sdk.git"
28
+ },
29
+ "keywords": [
30
+ "briij"
31
+ ],
32
+ "type": "module",
33
+ "main": "./lib/index.js",
34
+ "browser": "./lib/browser-index.js",
35
+ "typings": "./lib/index.d.ts",
36
+ "author": "textrp",
37
+ "license": "Apache-2.0",
38
+ "publishConfig": {
39
+ "registry": "https://registry.npmjs.org",
40
+ "access": "public"
41
+ },
42
+ "files": [
43
+ "lib",
44
+ "src",
45
+ "git-revision.txt",
46
+ "CHANGELOG.md",
47
+ "CONTRIBUTING.rst",
48
+ "LICENSE",
49
+ "README.md",
50
+ "package.json",
51
+ "release.sh"
52
+ ],
53
+ "dependencies": {
54
+ "@babel/runtime": "^7.12.5",
55
+ "@matrix-org/matrix-sdk-crypto-wasm": "^17.1.0",
56
+ "another-json": "^0.2.0",
57
+ "bs58": "^6.0.0",
58
+ "content-type": "^1.0.4",
59
+ "jwt-decode": "^4.0.0",
60
+ "loglevel": "^1.9.2",
61
+ "matrix-events-sdk": "0.0.1",
62
+ "matrix-widget-api": "^1.16.1",
63
+ "oidc-client-ts": "^3.0.1",
64
+ "p-retry": "7",
65
+ "sdp-transform": "^3.0.0",
66
+ "unhomoglyph": "^1.0.6",
67
+ "uuid": "13",
68
+ "xrpl": "^4.6.0"
69
+ },
70
+ "devDependencies": {
71
+ "@action-validator/cli": "^0.6.0",
72
+ "@action-validator/core": "^0.6.0",
73
+ "@babel/cli": "^7.12.10",
74
+ "@babel/core": "^7.12.10",
75
+ "@babel/eslint-parser": "^7.12.10",
76
+ "@babel/eslint-plugin": "^7.12.10",
77
+ "@babel/plugin-proposal-decorators": "^7.25.9",
78
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
79
+ "@babel/plugin-transform-class-properties": "^7.12.1",
80
+ "@babel/plugin-transform-numeric-separator": "^7.12.7",
81
+ "@babel/plugin-transform-object-rest-spread": "^7.12.1",
82
+ "@babel/plugin-transform-runtime": "^7.12.10",
83
+ "@babel/preset-env": "^7.12.11",
84
+ "@babel/preset-typescript": "^7.12.7",
85
+ "@fetch-mock/vitest": "^0.2.18",
86
+ "@matrix-org/olm": "3.2.15",
87
+ "@peculiar/webcrypto": "^1.4.5",
88
+ "@stylistic/eslint-plugin": "^5.0.0",
89
+ "@types/content-type": "^1.1.5",
90
+ "@types/debug": "^4.1.7",
91
+ "@types/node": "22",
92
+ "@types/sdp-transform": "^2.4.5",
93
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
94
+ "@typescript-eslint/parser": "^8.0.0",
95
+ "@vitest/coverage-v8": "^4.0.17",
96
+ "@vitest/eslint-plugin": "^1.6.6",
97
+ "@vitest/ui": "^4.0.17",
98
+ "babel-plugin-search-and-replace": "^1.1.1",
99
+ "debug": "^4.3.4",
100
+ "eslint": "^9.0.0",
101
+ "eslint-config-google": "^0.14.0",
102
+ "eslint-config-prettier": "^10.0.0",
103
+ "eslint-import-resolver-typescript": "^4.0.0",
104
+ "eslint-plugin-import": "^2.26.0",
105
+ "eslint-plugin-jsdoc": "^62.0.0",
106
+ "eslint-plugin-matrix-org": "^3.0.0",
107
+ "eslint-plugin-n": "^14.0.0",
108
+ "eslint-plugin-tsdoc": "^0.5.0",
109
+ "eslint-plugin-unicorn": "^56.0.0",
110
+ "fake-indexeddb": "^5.0.2",
111
+ "fetch-mock": "^12.6.0",
112
+ "happy-dom": "^20.1.0",
113
+ "husky": "^9.0.0",
114
+ "knip": "^5.0.0",
115
+ "lint-staged": "^16.0.0",
116
+ "matrix-mock-request": "^2.5.0",
117
+ "prettier": "3.8.1",
118
+ "typedoc": "^0.28.1",
119
+ "typedoc-plugin-coverage": "^4.0.0",
120
+ "typedoc-plugin-mdn-links": "^5.0.0",
121
+ "typedoc-plugin-missing-exports": "^4.0.0",
122
+ "typescript": "^5.4.2",
123
+ "vitest": "^4.0.17",
124
+ "vitest-sonar-reporter": "^3.0.0"
125
+ },
126
+ "resolutions": {
127
+ "expect": "30.2.0"
128
+ },
129
+ "packageManager": "pnpm@10.30.3+sha512.c961d1e0a2d8e354ecaa5166b822516668b7f44cb5bd95122d590dd81922f606f5473b6d23ec4a5be05e7fcd18e8488d47d978bbe981872f1145d06e9a740017"
130
+ }