@orbinum/sdk 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +10 -2
- package/dist/index.mjs +10 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -4819,6 +4819,15 @@ interface NoteBackupEntry {
|
|
|
4819
4819
|
encryptedMemo: string;
|
|
4820
4820
|
/** Merkle leaf index, when known. Informational — spends re-fetch the proof. */
|
|
4821
4821
|
leafIndex?: number;
|
|
4822
|
+
/**
|
|
4823
|
+
* Whether the note was already spent when exported. A local status flag (not
|
|
4824
|
+
* a key or secret), carried so a restored vault separates available from spent
|
|
4825
|
+
* without a chain round-trip. A host may still reconcile against the chain
|
|
4826
|
+
* afterward — this is a fast, possibly-stale hint, not the source of truth.
|
|
4827
|
+
*/
|
|
4828
|
+
spent?: boolean;
|
|
4829
|
+
/** Local timestamp the note was marked spent, when known. */
|
|
4830
|
+
spentAt?: number | null;
|
|
4822
4831
|
}
|
|
4823
4832
|
interface NoteBackup {
|
|
4824
4833
|
v: typeof NOTE_BACKUP_VERSION;
|
|
@@ -4854,6 +4863,10 @@ declare function decodeNoteBackup(json: string | object): NoteBackupEntry[];
|
|
|
4854
4863
|
* Ownership is proven by decryption — an entry whose memo does not open under
|
|
4855
4864
|
* these keys is silently skipped (it is not this user's note). No chain access:
|
|
4856
4865
|
* only the backup's own memos are tried.
|
|
4866
|
+
*
|
|
4867
|
+
* The decrypted note is reconstructed as unspent; the entry's `spent`/`spentAt`
|
|
4868
|
+
* flags are then applied so a restored vault separates available from spent. A
|
|
4869
|
+
* host may reconcile against the chain afterward if the backup could be stale.
|
|
4857
4870
|
*/
|
|
4858
4871
|
declare function importNotesFromBackup(entries: NoteBackupEntry[], keys: BackupImportKeys): ZkNote[];
|
|
4859
4872
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4819,6 +4819,15 @@ interface NoteBackupEntry {
|
|
|
4819
4819
|
encryptedMemo: string;
|
|
4820
4820
|
/** Merkle leaf index, when known. Informational — spends re-fetch the proof. */
|
|
4821
4821
|
leafIndex?: number;
|
|
4822
|
+
/**
|
|
4823
|
+
* Whether the note was already spent when exported. A local status flag (not
|
|
4824
|
+
* a key or secret), carried so a restored vault separates available from spent
|
|
4825
|
+
* without a chain round-trip. A host may still reconcile against the chain
|
|
4826
|
+
* afterward — this is a fast, possibly-stale hint, not the source of truth.
|
|
4827
|
+
*/
|
|
4828
|
+
spent?: boolean;
|
|
4829
|
+
/** Local timestamp the note was marked spent, when known. */
|
|
4830
|
+
spentAt?: number | null;
|
|
4822
4831
|
}
|
|
4823
4832
|
interface NoteBackup {
|
|
4824
4833
|
v: typeof NOTE_BACKUP_VERSION;
|
|
@@ -4854,6 +4863,10 @@ declare function decodeNoteBackup(json: string | object): NoteBackupEntry[];
|
|
|
4854
4863
|
* Ownership is proven by decryption — an entry whose memo does not open under
|
|
4855
4864
|
* these keys is silently skipped (it is not this user's note). No chain access:
|
|
4856
4865
|
* only the backup's own memos are tried.
|
|
4866
|
+
*
|
|
4867
|
+
* The decrypted note is reconstructed as unspent; the entry's `spent`/`spentAt`
|
|
4868
|
+
* flags are then applied so a restored vault separates available from spent. A
|
|
4869
|
+
* host may reconcile against the chain afterward if the backup could be stale.
|
|
4857
4870
|
*/
|
|
4858
4871
|
declare function importNotesFromBackup(entries: NoteBackupEntry[], keys: BackupImportKeys): ZkNote[];
|
|
4859
4872
|
|
package/dist/index.js
CHANGED
|
@@ -6336,7 +6336,9 @@ function noteToBackupEntry(note) {
|
|
|
6336
6336
|
return {
|
|
6337
6337
|
commitmentHex: note.commitmentHex,
|
|
6338
6338
|
encryptedMemo: toHex(Uint8Array.from(note.memo)),
|
|
6339
|
-
...note.leafIndex !== void 0 ? { leafIndex: note.leafIndex } : {}
|
|
6339
|
+
...note.leafIndex !== void 0 ? { leafIndex: note.leafIndex } : {},
|
|
6340
|
+
spent: note.spent,
|
|
6341
|
+
spentAt: note.spentAt
|
|
6340
6342
|
};
|
|
6341
6343
|
}
|
|
6342
6344
|
function encodeNoteBackup(notes, options = {}) {
|
|
@@ -6381,7 +6383,13 @@ function importNotesFromBackup(entries, keys) {
|
|
|
6381
6383
|
keys.spendingKey,
|
|
6382
6384
|
keys.ownerPk
|
|
6383
6385
|
);
|
|
6384
|
-
if (note)
|
|
6386
|
+
if (note) {
|
|
6387
|
+
out.push({
|
|
6388
|
+
...note,
|
|
6389
|
+
spent: entry.spent ?? false,
|
|
6390
|
+
spentAt: entry.spentAt ?? null
|
|
6391
|
+
});
|
|
6392
|
+
}
|
|
6385
6393
|
}
|
|
6386
6394
|
return out;
|
|
6387
6395
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -5232,7 +5232,9 @@ function noteToBackupEntry(note) {
|
|
|
5232
5232
|
return {
|
|
5233
5233
|
commitmentHex: note.commitmentHex,
|
|
5234
5234
|
encryptedMemo: toHex(Uint8Array.from(note.memo)),
|
|
5235
|
-
...note.leafIndex !== void 0 ? { leafIndex: note.leafIndex } : {}
|
|
5235
|
+
...note.leafIndex !== void 0 ? { leafIndex: note.leafIndex } : {},
|
|
5236
|
+
spent: note.spent,
|
|
5237
|
+
spentAt: note.spentAt
|
|
5236
5238
|
};
|
|
5237
5239
|
}
|
|
5238
5240
|
function encodeNoteBackup(notes, options = {}) {
|
|
@@ -5277,7 +5279,13 @@ function importNotesFromBackup(entries, keys) {
|
|
|
5277
5279
|
keys.spendingKey,
|
|
5278
5280
|
keys.ownerPk
|
|
5279
5281
|
);
|
|
5280
|
-
if (note)
|
|
5282
|
+
if (note) {
|
|
5283
|
+
out.push({
|
|
5284
|
+
...note,
|
|
5285
|
+
spent: entry.spent ?? false,
|
|
5286
|
+
spentAt: entry.spentAt ?? null
|
|
5287
|
+
});
|
|
5288
|
+
}
|
|
5281
5289
|
}
|
|
5282
5290
|
return out;
|
|
5283
5291
|
}
|