@keyhive/keyhive 0.1.0-alpha.4 → 0.1.0-alpha.5
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/package.json +1 -1
- package/pkg/keyhive_wasm.d.ts +23 -40
- package/pkg/keyhive_wasm.js +1 -1
- package/pkg/keyhive_wasm_bg.js +88 -81
- package/pkg/keyhive_wasm_bg.wasm +0 -0
- package/pkg/keyhive_wasm_bg.wasm.d.ts +132 -130
- package/pkg-node/keyhive_wasm.d.ts +23 -40
- package/pkg-node/keyhive_wasm.js +91 -84
- package/pkg-node/keyhive_wasm_bg.wasm +0 -0
- package/pkg-node/keyhive_wasm_bg.wasm.d.ts +132 -130
- package/pkg-slim/keyhive_wasm.d.ts +155 -170
- package/pkg-slim/keyhive_wasm.js +88 -81
- package/pkg-slim/keyhive_wasm_bg.wasm +0 -0
- package/pkg-slim/keyhive_wasm_bg.wasm.base64.js +1 -1
- package/pkg-slim/keyhive_wasm_bg.wasm.d.ts +132 -130
package/package.json
CHANGED
package/pkg/keyhive_wasm.d.ts
CHANGED
|
@@ -9,16 +9,6 @@ export class Access {
|
|
|
9
9
|
static tryFromString(s: string): Access | undefined;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
* The result of adding a member: the membership delegation.
|
|
14
|
-
*/
|
|
15
|
-
export class AddMemberUpdate {
|
|
16
|
-
private constructor();
|
|
17
|
-
free(): void;
|
|
18
|
-
[Symbol.dispose](): void;
|
|
19
|
-
readonly delegation: SignedDelegation;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
12
|
export class Agent {
|
|
23
13
|
private constructor();
|
|
24
14
|
free(): void;
|
|
@@ -127,16 +117,14 @@ export class ContactCard {
|
|
|
127
117
|
|
|
128
118
|
/**
|
|
129
119
|
* Plaintext plus the application secret key that decrypted it.
|
|
130
|
-
*
|
|
131
|
-
* The key lets the consumer recover the blob's external predecessor-secret
|
|
132
|
-
* chain and chain further encryptions onto it, without re-entering CGKA.
|
|
133
120
|
*/
|
|
134
|
-
export class
|
|
121
|
+
export class DecryptedKeyed {
|
|
135
122
|
private constructor();
|
|
136
123
|
free(): void;
|
|
137
124
|
[Symbol.dispose](): void;
|
|
138
125
|
/**
|
|
139
126
|
* The 32-byte application secret key used to decrypt this content.
|
|
127
|
+
* Treat as secret: do not log or persist unencrypted.
|
|
140
128
|
*/
|
|
141
129
|
readonly applicationSecret: Uint8Array;
|
|
142
130
|
readonly plaintext: Uint8Array;
|
|
@@ -192,8 +180,7 @@ export class Encrypted {
|
|
|
192
180
|
[Symbol.dispose](): void;
|
|
193
181
|
/**
|
|
194
182
|
* Decrypt this content with an explicit 32-byte application secret key,
|
|
195
|
-
* bypassing CGKA.
|
|
196
|
-
* predecessor-secret chain once it has recovered a blob's key.
|
|
183
|
+
* bypassing CGKA.
|
|
197
184
|
*/
|
|
198
185
|
decryptWithKey(key: Uint8Array): Uint8Array;
|
|
199
186
|
static fromBytes(bytes: Uint8Array): Encrypted;
|
|
@@ -212,11 +199,19 @@ export class EncryptedContentWithUpdate {
|
|
|
212
199
|
[Symbol.dispose](): void;
|
|
213
200
|
encrypted_content(): Encrypted;
|
|
214
201
|
update_op(): SignedCgkaOperation | undefined;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Encrypted content plus the application secret key it was encrypted under.
|
|
206
|
+
*/
|
|
207
|
+
export class EncryptedKeyed {
|
|
208
|
+
private constructor();
|
|
209
|
+
free(): void;
|
|
210
|
+
[Symbol.dispose](): void;
|
|
211
|
+
encrypted_content(): Encrypted;
|
|
212
|
+
update_op(): SignedCgkaOperation | undefined;
|
|
215
213
|
/**
|
|
216
214
|
* The 32-byte application secret key used to encrypt this content.
|
|
217
|
-
*
|
|
218
|
-
* Lets the consumer build the external predecessor-secret chain and chain
|
|
219
|
-
* further encryptions onto this blob.
|
|
220
215
|
*/
|
|
221
216
|
readonly applicationSecret: Uint8Array;
|
|
222
217
|
}
|
|
@@ -313,7 +308,7 @@ export class Keyhive {
|
|
|
313
308
|
free(): void;
|
|
314
309
|
[Symbol.dispose](): void;
|
|
315
310
|
accessForDoc(id: Identifier, doc_id: DocumentId): Promise<Access | undefined>;
|
|
316
|
-
addMember(to_add: Agent, membered: Membered, access: Access, other_relevant_docs: Document[]): Promise<
|
|
311
|
+
addMember(to_add: Agent, membered: Membered, access: Access, other_relevant_docs: Document[]): Promise<SignedDelegation>;
|
|
317
312
|
/**
|
|
318
313
|
* Returns all agent events with deduplicated storage and two-tier indirection
|
|
319
314
|
* for membership, prekey, and CGKA ops.
|
|
@@ -334,14 +329,9 @@ export class Keyhive {
|
|
|
334
329
|
/**
|
|
335
330
|
* Force a PCS key rotation and return the new leaf secret, serialized as a
|
|
336
331
|
* one-entry `BTreeMap<ShareKey, ShareSecretKey>` (the exact format
|
|
337
|
-
* `importPrekeySecrets` accepts).
|
|
338
|
-
* install it to derive the rotated key without re-importing the whole bundle.
|
|
332
|
+
* `importPrekeySecrets` accepts).
|
|
339
333
|
*/
|
|
340
334
|
forcePcsUpdate(doc: Document): Promise<Uint8Array>;
|
|
341
|
-
/**
|
|
342
|
-
* Generate a document. Whether it provides forward secrecy is determined by
|
|
343
|
-
* this peer's forward-secrecy policy (chosen at `Keyhive.init`).
|
|
344
|
-
*/
|
|
345
335
|
generateDocument(coparents: Peer[], initial_content_ref_head: ChangeId, more_initial_content_refs: ChangeId[]): Promise<Document>;
|
|
346
336
|
generateGroup(js_coparents: Peer[]): Promise<Group>;
|
|
347
337
|
getAgent(id: Identifier): Promise<Agent | undefined>;
|
|
@@ -352,9 +342,6 @@ export class Keyhive {
|
|
|
352
342
|
importPrekeySecrets(bytes: Uint8Array): Promise<void>;
|
|
353
343
|
ingestArchive(archive: Archive): Promise<void>;
|
|
354
344
|
ingestEventsBytes(events_bytes_array: Array<any>): Promise<Array<any>>;
|
|
355
|
-
/**
|
|
356
|
-
* Initialize a peer.
|
|
357
|
-
*/
|
|
358
345
|
static init(signer: Signer, ciphertext_store: CiphertextStore, event_handler: Function): Promise<Keyhive>;
|
|
359
346
|
intoArchive(): Promise<Archive>;
|
|
360
347
|
membershipOpsForAgent(agent: Agent): Promise<Map<any, any>>;
|
|
@@ -369,13 +356,15 @@ export class Keyhive {
|
|
|
369
356
|
tryDecrypt(doc: Document, encrypted: Encrypted): Promise<Uint8Array>;
|
|
370
357
|
/**
|
|
371
358
|
* Decrypt content and also return the 32-byte application secret key used.
|
|
372
|
-
*
|
|
373
|
-
* The consumer follows the external predecessor-secret chain from this key
|
|
374
|
-
* with `Encrypted.decryptWithKey`, avoiding further CGKA dives.
|
|
375
359
|
*/
|
|
376
|
-
|
|
360
|
+
tryDecryptKeyed(doc: Document, encrypted: Encrypted): Promise<DecryptedKeyed>;
|
|
377
361
|
tryEncrypt(doc: Document, content_ref: ChangeId, js_pred_refs: ChangeId[], content: Uint8Array): Promise<EncryptedContentWithUpdate>;
|
|
378
362
|
tryEncryptArchive(doc: Document, content_ref: ChangeId, pred_refs: ChangeId[], content: Uint8Array): Promise<EncryptedContentWithUpdate>;
|
|
363
|
+
/**
|
|
364
|
+
* Encrypt content and also return the application secret key it was
|
|
365
|
+
* encrypted under.
|
|
366
|
+
*/
|
|
367
|
+
tryEncryptKeyed(doc: Document, content_ref: ChangeId, js_pred_refs: ChangeId[], content: Uint8Array): Promise<EncryptedKeyed>;
|
|
379
368
|
tryPcsKeyHash(doc: Document): Promise<Uint8Array | undefined>;
|
|
380
369
|
trySign(data: Uint8Array): Promise<Signed>;
|
|
381
370
|
readonly id: IndividualId;
|
|
@@ -542,12 +531,6 @@ export function setPanicHook(): void;
|
|
|
542
531
|
export function symmetricDecrypt(key: Uint8Array, blob: Uint8Array): Uint8Array;
|
|
543
532
|
|
|
544
533
|
/**
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
* `associated_data` flavors the synthetic nonce (e.g. the document or content
|
|
548
|
-
* id) so identical plaintext under the same key in different contexts produces
|
|
549
|
-
* distinct ciphertext. Returns `nonce(24) || ciphertext` (the ciphertext
|
|
550
|
-
* includes the Poly1305 tag). The nonce is carried in the output, so
|
|
551
|
-
* [`symmetric_decrypt`] does not need the associated data.
|
|
534
|
+
* Encrypt `plaintext` under a 32-byte `key`, returning `nonce(24) || ciphertext`.
|
|
552
535
|
*/
|
|
553
536
|
export function symmetricEncrypt(key: Uint8Array, plaintext: Uint8Array, associated_data: Uint8Array): Uint8Array;
|
package/pkg/keyhive_wasm.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./keyhive_wasm_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
Access,
|
|
8
|
+
Access, Agent, AllAgentEvents, Archive, CannotParseEd25519SigningKey, CannotParseIdentifier, Capability, CgkaOperation, ChangeId, CiphertextStore, ContactCard, DecryptedKeyed, Delegation, DocContentRefs, Document, DocumentId, Encrypted, EncryptedContentWithUpdate, EncryptedKeyed, Event, GenerateWebCryptoError, Group, GroupId, History, Identifier, Individual, IndividualId, Invocation, Keyhive, Membered, Membership, Peer, Revocation, ShareKey, Signed, SignedCgkaOperation, SignedDelegation, SignedInvocation, SignedRevocation, Signer, Stats, Summary, setPanicHook, symmetricDecrypt, symmetricEncrypt
|
|
9
9
|
} from "./keyhive_wasm_bg.js";
|
package/pkg/keyhive_wasm_bg.js
CHANGED
|
@@ -43,36 +43,6 @@ export class Access {
|
|
|
43
43
|
}
|
|
44
44
|
if (Symbol.dispose) Access.prototype[Symbol.dispose] = Access.prototype.free;
|
|
45
45
|
|
|
46
|
-
/**
|
|
47
|
-
* The result of adding a member: the membership delegation.
|
|
48
|
-
*/
|
|
49
|
-
export class AddMemberUpdate {
|
|
50
|
-
static __wrap(ptr) {
|
|
51
|
-
const obj = Object.create(AddMemberUpdate.prototype);
|
|
52
|
-
obj.__wbg_ptr = ptr;
|
|
53
|
-
AddMemberUpdateFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
54
|
-
return obj;
|
|
55
|
-
}
|
|
56
|
-
__destroy_into_raw() {
|
|
57
|
-
const ptr = this.__wbg_ptr;
|
|
58
|
-
this.__wbg_ptr = 0;
|
|
59
|
-
AddMemberUpdateFinalization.unregister(this);
|
|
60
|
-
return ptr;
|
|
61
|
-
}
|
|
62
|
-
free() {
|
|
63
|
-
const ptr = this.__destroy_into_raw();
|
|
64
|
-
wasm.__wbg_addmemberupdate_free(ptr, 0);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @returns {SignedDelegation}
|
|
68
|
-
*/
|
|
69
|
-
get delegation() {
|
|
70
|
-
const ret = wasm.addmemberupdate_delegation(this.__wbg_ptr);
|
|
71
|
-
return SignedDelegation.__wrap(ret);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (Symbol.dispose) AddMemberUpdate.prototype[Symbol.dispose] = AddMemberUpdate.prototype.free;
|
|
75
|
-
|
|
76
46
|
export class Agent {
|
|
77
47
|
static __wrap(ptr) {
|
|
78
48
|
const obj = Object.create(Agent.prototype);
|
|
@@ -584,33 +554,31 @@ if (Symbol.dispose) ContactCard.prototype[Symbol.dispose] = ContactCard.prototyp
|
|
|
584
554
|
|
|
585
555
|
/**
|
|
586
556
|
* Plaintext plus the application secret key that decrypted it.
|
|
587
|
-
*
|
|
588
|
-
* The key lets the consumer recover the blob's external predecessor-secret
|
|
589
|
-
* chain and chain further encryptions onto it, without re-entering CGKA.
|
|
590
557
|
*/
|
|
591
|
-
export class
|
|
558
|
+
export class DecryptedKeyed {
|
|
592
559
|
static __wrap(ptr) {
|
|
593
|
-
const obj = Object.create(
|
|
560
|
+
const obj = Object.create(DecryptedKeyed.prototype);
|
|
594
561
|
obj.__wbg_ptr = ptr;
|
|
595
|
-
|
|
562
|
+
DecryptedKeyedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
596
563
|
return obj;
|
|
597
564
|
}
|
|
598
565
|
__destroy_into_raw() {
|
|
599
566
|
const ptr = this.__wbg_ptr;
|
|
600
567
|
this.__wbg_ptr = 0;
|
|
601
|
-
|
|
568
|
+
DecryptedKeyedFinalization.unregister(this);
|
|
602
569
|
return ptr;
|
|
603
570
|
}
|
|
604
571
|
free() {
|
|
605
572
|
const ptr = this.__destroy_into_raw();
|
|
606
|
-
wasm.
|
|
573
|
+
wasm.__wbg_decryptedkeyed_free(ptr, 0);
|
|
607
574
|
}
|
|
608
575
|
/**
|
|
609
576
|
* The 32-byte application secret key used to decrypt this content.
|
|
577
|
+
* Treat as secret: do not log or persist unencrypted.
|
|
610
578
|
* @returns {Uint8Array}
|
|
611
579
|
*/
|
|
612
580
|
get applicationSecret() {
|
|
613
|
-
const ret = wasm.
|
|
581
|
+
const ret = wasm.decryptedkeyed_applicationSecret(this.__wbg_ptr);
|
|
614
582
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
615
583
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
616
584
|
return v1;
|
|
@@ -619,13 +587,13 @@ export class DecryptedWithKey {
|
|
|
619
587
|
* @returns {Uint8Array}
|
|
620
588
|
*/
|
|
621
589
|
get plaintext() {
|
|
622
|
-
const ret = wasm.
|
|
590
|
+
const ret = wasm.decryptedkeyed_plaintext(this.__wbg_ptr);
|
|
623
591
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
624
592
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
625
593
|
return v1;
|
|
626
594
|
}
|
|
627
595
|
}
|
|
628
|
-
if (Symbol.dispose)
|
|
596
|
+
if (Symbol.dispose) DecryptedKeyed.prototype[Symbol.dispose] = DecryptedKeyed.prototype.free;
|
|
629
597
|
|
|
630
598
|
export class Delegation {
|
|
631
599
|
static __wrap(ptr) {
|
|
@@ -908,8 +876,7 @@ export class Encrypted {
|
|
|
908
876
|
}
|
|
909
877
|
/**
|
|
910
878
|
* Decrypt this content with an explicit 32-byte application secret key,
|
|
911
|
-
* bypassing CGKA.
|
|
912
|
-
* predecessor-secret chain once it has recovered a blob's key.
|
|
879
|
+
* bypassing CGKA.
|
|
913
880
|
* @param {Uint8Array} key
|
|
914
881
|
* @returns {Uint8Array}
|
|
915
882
|
*/
|
|
@@ -1005,15 +972,49 @@ export class EncryptedContentWithUpdate {
|
|
|
1005
972
|
const ptr = this.__destroy_into_raw();
|
|
1006
973
|
wasm.__wbg_encryptedcontentwithupdate_free(ptr, 0);
|
|
1007
974
|
}
|
|
975
|
+
/**
|
|
976
|
+
* @returns {Encrypted}
|
|
977
|
+
*/
|
|
978
|
+
encrypted_content() {
|
|
979
|
+
const ret = wasm.encryptedcontentwithupdate_encrypted_content(this.__wbg_ptr);
|
|
980
|
+
return Encrypted.__wrap(ret);
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* @returns {SignedCgkaOperation | undefined}
|
|
984
|
+
*/
|
|
985
|
+
update_op() {
|
|
986
|
+
const ret = wasm.encryptedcontentwithupdate_update_op(this.__wbg_ptr);
|
|
987
|
+
return ret === 0 ? undefined : SignedCgkaOperation.__wrap(ret);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
if (Symbol.dispose) EncryptedContentWithUpdate.prototype[Symbol.dispose] = EncryptedContentWithUpdate.prototype.free;
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Encrypted content plus the application secret key it was encrypted under.
|
|
994
|
+
*/
|
|
995
|
+
export class EncryptedKeyed {
|
|
996
|
+
static __wrap(ptr) {
|
|
997
|
+
const obj = Object.create(EncryptedKeyed.prototype);
|
|
998
|
+
obj.__wbg_ptr = ptr;
|
|
999
|
+
EncryptedKeyedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1000
|
+
return obj;
|
|
1001
|
+
}
|
|
1002
|
+
__destroy_into_raw() {
|
|
1003
|
+
const ptr = this.__wbg_ptr;
|
|
1004
|
+
this.__wbg_ptr = 0;
|
|
1005
|
+
EncryptedKeyedFinalization.unregister(this);
|
|
1006
|
+
return ptr;
|
|
1007
|
+
}
|
|
1008
|
+
free() {
|
|
1009
|
+
const ptr = this.__destroy_into_raw();
|
|
1010
|
+
wasm.__wbg_encryptedkeyed_free(ptr, 0);
|
|
1011
|
+
}
|
|
1008
1012
|
/**
|
|
1009
1013
|
* The 32-byte application secret key used to encrypt this content.
|
|
1010
|
-
*
|
|
1011
|
-
* Lets the consumer build the external predecessor-secret chain and chain
|
|
1012
|
-
* further encryptions onto this blob.
|
|
1013
1014
|
* @returns {Uint8Array}
|
|
1014
1015
|
*/
|
|
1015
1016
|
get applicationSecret() {
|
|
1016
|
-
const ret = wasm.
|
|
1017
|
+
const ret = wasm.encryptedkeyed_applicationSecret(this.__wbg_ptr);
|
|
1017
1018
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1018
1019
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1019
1020
|
return v1;
|
|
@@ -1022,18 +1023,18 @@ export class EncryptedContentWithUpdate {
|
|
|
1022
1023
|
* @returns {Encrypted}
|
|
1023
1024
|
*/
|
|
1024
1025
|
encrypted_content() {
|
|
1025
|
-
const ret = wasm.
|
|
1026
|
+
const ret = wasm.encryptedkeyed_encrypted_content(this.__wbg_ptr);
|
|
1026
1027
|
return Encrypted.__wrap(ret);
|
|
1027
1028
|
}
|
|
1028
1029
|
/**
|
|
1029
1030
|
* @returns {SignedCgkaOperation | undefined}
|
|
1030
1031
|
*/
|
|
1031
1032
|
update_op() {
|
|
1032
|
-
const ret = wasm.
|
|
1033
|
+
const ret = wasm.encryptedkeyed_update_op(this.__wbg_ptr);
|
|
1033
1034
|
return ret === 0 ? undefined : SignedCgkaOperation.__wrap(ret);
|
|
1034
1035
|
}
|
|
1035
1036
|
}
|
|
1036
|
-
if (Symbol.dispose)
|
|
1037
|
+
if (Symbol.dispose) EncryptedKeyed.prototype[Symbol.dispose] = EncryptedKeyed.prototype.free;
|
|
1037
1038
|
|
|
1038
1039
|
export class Event {
|
|
1039
1040
|
static __wrap(ptr) {
|
|
@@ -1483,7 +1484,7 @@ export class Keyhive {
|
|
|
1483
1484
|
* @param {Membered} membered
|
|
1484
1485
|
* @param {Access} access
|
|
1485
1486
|
* @param {Document[]} other_relevant_docs
|
|
1486
|
-
* @returns {Promise<
|
|
1487
|
+
* @returns {Promise<SignedDelegation>}
|
|
1487
1488
|
*/
|
|
1488
1489
|
addMember(to_add, membered, access, other_relevant_docs) {
|
|
1489
1490
|
_assertClass(to_add, Agent);
|
|
@@ -1556,8 +1557,7 @@ export class Keyhive {
|
|
|
1556
1557
|
/**
|
|
1557
1558
|
* Force a PCS key rotation and return the new leaf secret, serialized as a
|
|
1558
1559
|
* one-entry `BTreeMap<ShareKey, ShareSecretKey>` (the exact format
|
|
1559
|
-
* `importPrekeySecrets` accepts).
|
|
1560
|
-
* install it to derive the rotated key without re-importing the whole bundle.
|
|
1560
|
+
* `importPrekeySecrets` accepts).
|
|
1561
1561
|
* @param {Document} doc
|
|
1562
1562
|
* @returns {Promise<Uint8Array>}
|
|
1563
1563
|
*/
|
|
@@ -1567,8 +1567,6 @@ export class Keyhive {
|
|
|
1567
1567
|
return ret;
|
|
1568
1568
|
}
|
|
1569
1569
|
/**
|
|
1570
|
-
* Generate a document. Whether it provides forward secrecy is determined by
|
|
1571
|
-
* this peer's forward-secrecy policy (chosen at `Keyhive.init`).
|
|
1572
1570
|
* @param {Peer[]} coparents
|
|
1573
1571
|
* @param {ChangeId} initial_content_ref_head
|
|
1574
1572
|
* @param {ChangeId[]} more_initial_content_refs
|
|
@@ -1693,7 +1691,6 @@ export class Keyhive {
|
|
|
1693
1691
|
return ret;
|
|
1694
1692
|
}
|
|
1695
1693
|
/**
|
|
1696
|
-
* Initialize a peer.
|
|
1697
1694
|
* @param {Signer} signer
|
|
1698
1695
|
* @param {CiphertextStore} ciphertext_store
|
|
1699
1696
|
* @param {Function} event_handler
|
|
@@ -1802,17 +1799,14 @@ export class Keyhive {
|
|
|
1802
1799
|
}
|
|
1803
1800
|
/**
|
|
1804
1801
|
* Decrypt content and also return the 32-byte application secret key used.
|
|
1805
|
-
*
|
|
1806
|
-
* The consumer follows the external predecessor-secret chain from this key
|
|
1807
|
-
* with `Encrypted.decryptWithKey`, avoiding further CGKA dives.
|
|
1808
1802
|
* @param {Document} doc
|
|
1809
1803
|
* @param {Encrypted} encrypted
|
|
1810
|
-
* @returns {Promise<
|
|
1804
|
+
* @returns {Promise<DecryptedKeyed>}
|
|
1811
1805
|
*/
|
|
1812
|
-
|
|
1806
|
+
tryDecryptKeyed(doc, encrypted) {
|
|
1813
1807
|
_assertClass(doc, Document);
|
|
1814
1808
|
_assertClass(encrypted, Encrypted);
|
|
1815
|
-
const ret = wasm.
|
|
1809
|
+
const ret = wasm.keyhive_tryDecryptKeyed(this.__wbg_ptr, doc.__wbg_ptr, encrypted.__wbg_ptr);
|
|
1816
1810
|
return ret;
|
|
1817
1811
|
}
|
|
1818
1812
|
/**
|
|
@@ -1849,6 +1843,25 @@ export class Keyhive {
|
|
|
1849
1843
|
const ret = wasm.keyhive_tryEncryptArchive(this.__wbg_ptr, doc.__wbg_ptr, content_ref.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1850
1844
|
return ret;
|
|
1851
1845
|
}
|
|
1846
|
+
/**
|
|
1847
|
+
* Encrypt content and also return the application secret key it was
|
|
1848
|
+
* encrypted under.
|
|
1849
|
+
* @param {Document} doc
|
|
1850
|
+
* @param {ChangeId} content_ref
|
|
1851
|
+
* @param {ChangeId[]} js_pred_refs
|
|
1852
|
+
* @param {Uint8Array} content
|
|
1853
|
+
* @returns {Promise<EncryptedKeyed>}
|
|
1854
|
+
*/
|
|
1855
|
+
tryEncryptKeyed(doc, content_ref, js_pred_refs, content) {
|
|
1856
|
+
_assertClass(doc, Document);
|
|
1857
|
+
_assertClass(content_ref, ChangeId);
|
|
1858
|
+
const ptr0 = passArrayJsValueToWasm0(js_pred_refs, wasm.__wbindgen_malloc);
|
|
1859
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1860
|
+
const ptr1 = passArray8ToWasm0(content, wasm.__wbindgen_malloc);
|
|
1861
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1862
|
+
const ret = wasm.keyhive_tryEncryptKeyed(this.__wbg_ptr, doc.__wbg_ptr, content_ref.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
1863
|
+
return ret;
|
|
1864
|
+
}
|
|
1852
1865
|
/**
|
|
1853
1866
|
* @param {Document} doc
|
|
1854
1867
|
* @returns {Promise<Uint8Array | undefined>}
|
|
@@ -2662,13 +2675,7 @@ export function symmetricDecrypt(key, blob) {
|
|
|
2662
2675
|
}
|
|
2663
2676
|
|
|
2664
2677
|
/**
|
|
2665
|
-
*
|
|
2666
|
-
*
|
|
2667
|
-
* `associated_data` flavors the synthetic nonce (e.g. the document or content
|
|
2668
|
-
* id) so identical plaintext under the same key in different contexts produces
|
|
2669
|
-
* distinct ciphertext. Returns `nonce(24) || ciphertext` (the ciphertext
|
|
2670
|
-
* includes the Poly1305 tag). The nonce is carried in the output, so
|
|
2671
|
-
* [`symmetric_decrypt`] does not need the associated data.
|
|
2678
|
+
* Encrypt `plaintext` under a 32-byte `key`, returning `nonce(24) || ciphertext`.
|
|
2672
2679
|
* @param {Uint8Array} key
|
|
2673
2680
|
* @param {Uint8Array} plaintext
|
|
2674
2681
|
* @param {Uint8Array} associated_data
|
|
@@ -2749,10 +2756,6 @@ export function __wbg_add_6c7b67a080be853e(arg0, arg1) {
|
|
|
2749
2756
|
const ret = arg0.add(arg1);
|
|
2750
2757
|
return ret;
|
|
2751
2758
|
}
|
|
2752
|
-
export function __wbg_addmemberupdate_new(arg0) {
|
|
2753
|
-
const ret = AddMemberUpdate.__wrap(arg0);
|
|
2754
|
-
return ret;
|
|
2755
|
-
}
|
|
2756
2759
|
export function __wbg_agent_new(arg0) {
|
|
2757
2760
|
const ret = Agent.__wrap(arg0);
|
|
2758
2761
|
return ret;
|
|
@@ -2819,8 +2822,8 @@ export function __wbg_debug_3003e89da631cad7(arg0, arg1) {
|
|
|
2819
2822
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
2820
2823
|
}
|
|
2821
2824
|
}
|
|
2822
|
-
export function
|
|
2823
|
-
const ret =
|
|
2825
|
+
export function __wbg_decryptedkeyed_new(arg0) {
|
|
2826
|
+
const ret = DecryptedKeyed.__wrap(arg0);
|
|
2824
2827
|
return ret;
|
|
2825
2828
|
}
|
|
2826
2829
|
export function __wbg_doccontentrefs_new(arg0) {
|
|
@@ -2835,6 +2838,10 @@ export function __wbg_encryptedcontentwithupdate_new(arg0) {
|
|
|
2835
2838
|
const ret = EncryptedContentWithUpdate.__wrap(arg0);
|
|
2836
2839
|
return ret;
|
|
2837
2840
|
}
|
|
2841
|
+
export function __wbg_encryptedkeyed_new(arg0) {
|
|
2842
|
+
const ret = EncryptedKeyed.__wrap(arg0);
|
|
2843
|
+
return ret;
|
|
2844
|
+
}
|
|
2838
2845
|
export function __wbg_error_8b62d3db440cf4a8(arg0, arg1) {
|
|
2839
2846
|
let deferred0_0;
|
|
2840
2847
|
let deferred0_1;
|
|
@@ -3170,7 +3177,7 @@ export function __wbg_warn_9d7408e9659996aa(arg0, arg1, arg2, arg3, arg4, arg5,
|
|
|
3170
3177
|
}
|
|
3171
3178
|
}
|
|
3172
3179
|
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
3173
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
3180
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 716, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
3174
3181
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h9887d5ab72723f8a);
|
|
3175
3182
|
return ret;
|
|
3176
3183
|
}
|
|
@@ -3263,9 +3270,6 @@ function wasm_bindgen__convert__closures_____invoke__h58982df154245cbc(arg0, arg
|
|
|
3263
3270
|
const AccessFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3264
3271
|
? { register: () => {}, unregister: () => {} }
|
|
3265
3272
|
: new FinalizationRegistry(ptr => wasm.__wbg_access_free(ptr, 1));
|
|
3266
|
-
const AddMemberUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3267
|
-
? { register: () => {}, unregister: () => {} }
|
|
3268
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_addmemberupdate_free(ptr, 1));
|
|
3269
3273
|
const AgentFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3270
3274
|
? { register: () => {}, unregister: () => {} }
|
|
3271
3275
|
: new FinalizationRegistry(ptr => wasm.__wbg_agent_free(ptr, 1));
|
|
@@ -3296,9 +3300,9 @@ const CiphertextStoreFinalization = (typeof FinalizationRegistry === 'undefined'
|
|
|
3296
3300
|
const ContactCardFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3297
3301
|
? { register: () => {}, unregister: () => {} }
|
|
3298
3302
|
: new FinalizationRegistry(ptr => wasm.__wbg_contactcard_free(ptr, 1));
|
|
3299
|
-
const
|
|
3303
|
+
const DecryptedKeyedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3300
3304
|
? { register: () => {}, unregister: () => {} }
|
|
3301
|
-
: new FinalizationRegistry(ptr => wasm.
|
|
3305
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_decryptedkeyed_free(ptr, 1));
|
|
3302
3306
|
const DelegationFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3303
3307
|
? { register: () => {}, unregister: () => {} }
|
|
3304
3308
|
: new FinalizationRegistry(ptr => wasm.__wbg_delegation_free(ptr, 1));
|
|
@@ -3317,6 +3321,9 @@ const EncryptedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
3317
3321
|
const EncryptedContentWithUpdateFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3318
3322
|
? { register: () => {}, unregister: () => {} }
|
|
3319
3323
|
: new FinalizationRegistry(ptr => wasm.__wbg_encryptedcontentwithupdate_free(ptr, 1));
|
|
3324
|
+
const EncryptedKeyedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3325
|
+
? { register: () => {}, unregister: () => {} }
|
|
3326
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_encryptedkeyed_free(ptr, 1));
|
|
3320
3327
|
const EventFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
3321
3328
|
? { register: () => {}, unregister: () => {} }
|
|
3322
3329
|
: new FinalizationRegistry(ptr => wasm.__wbg_event_free(ptr, 1));
|
package/pkg/keyhive_wasm_bg.wasm
CHANGED
|
Binary file
|