sigelo-contact 0.1.2 → 0.1.4

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.
@@ -5,7 +5,7 @@
5
5
  "kinds": {
6
6
  "1": "invite answer (sigelo-invite/0), on the answer topic, key invite.key",
7
7
  "2": "invite reply, on the reply topic, key invite.key",
8
- "4": "contact notice {bundle: the chain, proof: {body: {v, typ: \"contact-notice\", did: the current DID, pair}, sig}}, on the mailbox topic, key notice_key",
8
+ "4": "contact notice {bundle: the chain, proof: {body: {v, typ: \"contact-notice\", did: the current DID, pair}, sig}}, on the mailbox topic, key notice_key; a chain that brings a recovery the receiver had not followed burns K there (re_pair)",
9
9
  "5": "prekeys {prekeys: a signed sigelo-msg/0 bundle, want: boolean, known: the receiver's current DID as the sender holds it}, on the mailbox topic, key prekeys_key"
10
10
  },
11
11
  "checks": [
@@ -21,6 +21,7 @@
21
21
  "A-recovery": "454ce5f5685e58e88ef2f2486044619ea68a0b6debb29ac75e2a171be584e715",
22
22
  "B0": "86763120acce1ef54ab133204f4cf69389897db660550bcb66123dce83cbceb2",
23
23
  "B1": "c7383152d2b12d9d3f3bdf624ee5da01bd59fb5f934579c824a38bdd5e7dd1c6",
24
+ "B2": "c063e86891a773ab781ed81440d8804e22e38eb6303fe1e88117125fe8f8a401",
24
25
  "B-recovery": "89b2386ca7a917c6ce924b50275199c9a3023ce0d6ba7073c8eba67e0237da1e",
25
26
  "invite secret": "b0172e2b06c6823696fe004a47548fab886e6b02497ca5c60f42e357ab66485f",
26
27
  "frame key": "c7f3174feec9236091ae203740b316e664923afd0cbdee075b8b7051d6b7bb08"
@@ -61,6 +62,18 @@
61
62
  "created": "2026-10-01T00:00:00Z",
62
63
  "nonce": "zBMQvrDEGNvFkXT9FSwbomb"
63
64
  }
65
+ },
66
+ "B2": {
67
+ "did": "did:sigelo:z89LJWNN6xhZecZh3etsoeN3B5PVTR6ZpFdG5WTmowmhw",
68
+ "key": "z6MkswVBj5QuowJ8p2q74fwwp9ro5T8gUsBdbzeVJBfU21WF",
69
+ "genesis": {
70
+ "v": "sigelo/0",
71
+ "typ": "genesis",
72
+ "key": "z6MkswVBj5QuowJ8p2q74fwwp9ro5T8gUsBdbzeVJBfU21WF",
73
+ "recovery": "sha256:30386f4d6dd00e8db89549701991ebefc774cdde58930d4fcb05de20963d6fb6",
74
+ "created": "2026-10-01T00:00:00Z",
75
+ "nonce": "z6kBjogap2P7sYPpZiZsYit"
76
+ }
64
77
  }
65
78
  },
66
79
  "rotation": {
@@ -82,6 +95,26 @@
82
95
  "nonce": "zBMQvrDEGNvFkXT9FSwbomb"
83
96
  }
84
97
  },
98
+ "recovery": {
99
+ "body": {
100
+ "v": "sigelo/0",
101
+ "typ": "rotation",
102
+ "id": "did:sigelo:z6TXk8bPrkHpTXzuo3gjyNnsibUhR19Nswq5v89iBo8B3",
103
+ "next": "did:sigelo:z89LJWNN6xhZecZh3etsoeN3B5PVTR6ZpFdG5WTmowmhw",
104
+ "iat": 1791257000,
105
+ "reason": "recovery",
106
+ "recovery_key": "z6MknFEB9GzhsiMvQuYotqHKSXgumZkLZaJc6pkyGa6sir4B"
107
+ },
108
+ "sig": "zcNFYTahu2C7A32BG7ehGNN2HfsnyWu4ommKao1ZtsW9po9AroyzMFsdU7Hhyb7YEkWb5QaWMTZbYZ69jSt4QXbw",
109
+ "next_genesis": {
110
+ "v": "sigelo/0",
111
+ "typ": "genesis",
112
+ "key": "z6MkswVBj5QuowJ8p2q74fwwp9ro5T8gUsBdbzeVJBfU21WF",
113
+ "recovery": "sha256:30386f4d6dd00e8db89549701991ebefc774cdde58930d4fcb05de20963d6fb6",
114
+ "created": "2026-10-01T00:00:00Z",
115
+ "nonce": "z6kBjogap2P7sYPpZiZsYit"
116
+ }
117
+ },
85
118
  "derived": {
86
119
  "invite": {
87
120
  "secret": "b0172e2b06c6823696fe004a47548fab886e6b02497ca5c60f42e357ab66485f",
@@ -550,6 +583,85 @@
550
583
  "length": 1342,
551
584
  "sha256": "53fbcaab644a093926f31fe67f9361ad0cfb95ae9ed3187891ec2f0ba377a0d0",
552
585
  "hex": "0104000000000000000000000000000000000000000120164d0813e9a54ba2ca466de71493e863dad8a1345afac944d2757810c1c1c66831dbfcf3bc33cd2684c719c06e9f3d0dc56c0d35da73051f23f1d9af660bb99df6e2c4b424f46f4567ffcecec98ac789bcf1cf12dc4fa371e65e3ab826720329609cfa92f4c850ecc9b0a9fb93b457e57c51aba991e5d05d5a8b07561531dd680463557f0b278d9b9eee402559eadd21bbd878b9cd4ee8e31990f2f68c90667af80f105ab943cd94f449a6bcfa066db10e389304412474ffa0994947dc5b62386d8a6ad56f3b94e5a95ae28227bc0477c43ba184cac87d249c4be847120d54c255d84ed7d6ec1d27c0ea35f662bfd06f41f13c46ab81076bbf837e5298a8c3afa051a3b70e3dd1ca9ffc43eee04c463d4071b4a4696dcb01ff10dd929ba99884b23db71109c52f359d762172a55ca511ba8f7d94b249e6b002fd56bbdc958119a8277f9fc0bf96531641ac98dda85874847ebd063cbfcc5e8648eb2ccbd829088400904a64c5e6f9ac7aafeee4debf026071c1cb2ecdcbebc06b859c8e33fa84130aa69b76fd864cc01e4cfabeceb0ca372a1526af3b4febc639f37e15d122baff2cf04f684c1c7e9810b87112bc539ccae8e03614b300545c0a1515779f0f33a2544d808ea77bd58aacf64fb8c0270a0e9092ea6d1408a5a3ed47785f1f4f076e0012d32eebcdaaeb99d9599b8d2d5406cac5c3c6d7144112f03ae445e8db677222fa84447a260a025619a8d3e52cd2ab873321643d3099e5aa930d8f47219a7db6fa4f9f526b032f51c7af9a0571e2f903ead7cdbfae2faf7cd5bfc1a9ba7c2ea0f4e48fa79fa228e90c0bb59d7a1b23a20c1be938250a73049dacb0287543018667a78eb309cfdffcbdbf6e45b54f1903c59a8f5847ee52b42e22d405d6fb3ec711c42f58f8f34cbe33c0fcaebaf8d08243d80fb7904674ed63d604aacc97fe71a308c35ac795836d404ab2578c29805e988ae11722f8d7fdf945a1d352b67bed9b2fa9fd5d7b0e17df6c2bdc5ffa8fb2dc21f41ac020d1ffbd22e496c26c2a28eaee0496417db2022ec42ce82cc927827e171f0245c1c491c04f978635e36d65ffeb1dca97a7e187b855ee811906a0f7c46f61ed4467dedf8c015db4e776b5e0e3dd095271b0a87b96e92315f1d8e3554ff07071190493c22ad65280758123dce3e129c4f649f5526eee5bedfbaed106aa46e28daba40ee7c1ca160ed98a28cd4092580d4e5c06dc3f0368079aaf39b893976cf7f4226dc582934c80254d7ab12d16e5a9f7ad50412d8e90a7be46d374763aa8d691ff168ed242ecf2eb63978edf61d4e43ef046f08cd190a1d4cd4d356c8a7816eecb0482d7fb5ef7ac71e6c0635b6b26b98b0022ce897b70f2e0aa0d78461e5b75c40cb278e91fa1df40c8dfe8e75fa04813916fa79f8f68cfa2f839469da1d976fa5ae5a76cf0426bbfb067dac512159e879abb2360383b7032ed03702cb6f688dbc5e4212769e1fa5a8078247312a884d691745c3b5250933a1f95419b0f596f6f14d6958fa5e51366b1fee699baf5cb711a4015d3e3296f8f4900a67477591d659837700ded9259d4038e9670c4cb6fc13d225728339ae2eb0fe9c09650be3576165049a431d07097257b21d033338c97f0b54fdd0ad8b74274524bf2efc06705f760d92500c509e41e527926694b58204fe29bed4338854abdb2a3bc542846b3b5aa5b2d059d83a637d3797708832b350871d44362a566d48489567ac5ac62d05de3cc6a5015edacddaab1717634dff4d99644903980c3cb82036e68bd961d9e822ec8aa3eb246c195476134ee175448a279842b1dd7205244d9c22e8f8c9745f8d0fc789c81ba9accd1390b79cafd"
586
+ },
587
+ {
588
+ "case": "notice_recovery",
589
+ "kind": 4,
590
+ "key_from": "notice_key",
591
+ "key": "ba99871b3e22c5c71e5c95c79a73741fbd701168d0183cfffbb99c1386c6306c",
592
+ "topic": "m/5be6b9f80c7b2439a5cb6904c3e06778",
593
+ "nonce": "0056d1281c0173fc533bc7f74fd7d566e39c49584b129be4",
594
+ "value": {
595
+ "bundle": {
596
+ "v": "sigelo/0",
597
+ "typ": "bundle",
598
+ "genesis": {
599
+ "v": "sigelo/0",
600
+ "typ": "genesis",
601
+ "key": "z6MkkoWKy8Aw6tZ1KNcrQYKjU2MeXDvPoVv5NBpvEq3rzyyy",
602
+ "recovery": "sha256:30386f4d6dd00e8db89549701991ebefc774cdde58930d4fcb05de20963d6fb6",
603
+ "created": "2026-10-01T00:00:00Z",
604
+ "nonce": "zLgygMUMhQs4vPUovYXLLXN"
605
+ },
606
+ "rotations": [
607
+ {
608
+ "body": {
609
+ "v": "sigelo/0",
610
+ "typ": "rotation",
611
+ "id": "did:sigelo:z6TXk8bPrkHpTXzuo3gjyNnsibUhR19Nswq5v89iBo8B3",
612
+ "next": "did:sigelo:z92ycmgLsn2XUVi9ED3W2b3M5C8AtPQRB1gb2ar7zbF4f",
613
+ "iat": 1791256900,
614
+ "reason": "voluntary"
615
+ },
616
+ "sig": "z3ZJ4sidVA6QX1mNKLzFBMPcjKGw1dP9FQCfSyrBxfpEBUM6MWJ77hi2zg4Z4biYYqurt73s3992U873dGKJH5Ye6",
617
+ "next_genesis": {
618
+ "v": "sigelo/0",
619
+ "typ": "genesis",
620
+ "key": "z6MkuE83V94fRXCUkCErBcLe7LA9TLPkoSmZ8KAgRPzNvQQ7",
621
+ "recovery": "sha256:30386f4d6dd00e8db89549701991ebefc774cdde58930d4fcb05de20963d6fb6",
622
+ "created": "2026-10-01T00:00:00Z",
623
+ "nonce": "zBMQvrDEGNvFkXT9FSwbomb"
624
+ }
625
+ },
626
+ {
627
+ "body": {
628
+ "v": "sigelo/0",
629
+ "typ": "rotation",
630
+ "id": "did:sigelo:z6TXk8bPrkHpTXzuo3gjyNnsibUhR19Nswq5v89iBo8B3",
631
+ "next": "did:sigelo:z89LJWNN6xhZecZh3etsoeN3B5PVTR6ZpFdG5WTmowmhw",
632
+ "iat": 1791257000,
633
+ "reason": "recovery",
634
+ "recovery_key": "z6MknFEB9GzhsiMvQuYotqHKSXgumZkLZaJc6pkyGa6sir4B"
635
+ },
636
+ "sig": "zcNFYTahu2C7A32BG7ehGNN2HfsnyWu4ommKao1ZtsW9po9AroyzMFsdU7Hhyb7YEkWb5QaWMTZbYZ69jSt4QXbw",
637
+ "next_genesis": {
638
+ "v": "sigelo/0",
639
+ "typ": "genesis",
640
+ "key": "z6MkswVBj5QuowJ8p2q74fwwp9ro5T8gUsBdbzeVJBfU21WF",
641
+ "recovery": "sha256:30386f4d6dd00e8db89549701991ebefc774cdde58930d4fcb05de20963d6fb6",
642
+ "created": "2026-10-01T00:00:00Z",
643
+ "nonce": "z6kBjogap2P7sYPpZiZsYit"
644
+ }
645
+ }
646
+ ],
647
+ "bindings": [],
648
+ "attestations": [],
649
+ "issuers": []
650
+ },
651
+ "proof": {
652
+ "body": {
653
+ "v": "sigelo-carrier/0",
654
+ "typ": "contact-notice",
655
+ "did": "did:sigelo:z89LJWNN6xhZecZh3etsoeN3B5PVTR6ZpFdG5WTmowmhw",
656
+ "pair": "a2cf45bd3d6aee6d6e3f14ffd2751924"
657
+ },
658
+ "sig": "zfohWGDS1r8mzxuVoAjXPu8R3GEeBo7jNo6gBBywk4w4zXe23Ki7ZEqR5xu2LwqPo447EGkan9Ea55rMWjWiBrT7"
659
+ }
660
+ },
661
+ "note": "bob's contact notice after his recovery B0 -> B2, which beats the thief's B0 -> B1: a proof signed by B2. Alice, who followed B1, merges a recovery she had not followed: she marks bob re_pair \"contact_recovery\", since K may be the thief's, and sends him nothing more until a new pairing",
662
+ "length": 2110,
663
+ "sha256": "14fe3e6b39686760134678f5904206d14e42609da2f3548b1aec37d0ee192fa5",
664
+ "hex": "010400000000000000000000000000000000000000010056d1281c0173fc533bc7f74fd7d566e39c49584b129be4c34de3627486193ede6942f1cab6c91afd85996bf59752463c81e48eb56db6e25f9883e535362baed3210f1f95d2638cfea2b9146e79ece77e8715a90fa604e26cb1a59891a09829f144cf211f1124bce328b5da013b43735d33f3144a4cf86aecb053a29f96fca0f4478d2a008e4045db9ac6ff837e98e6335417d3e5f95b6451ad51e88c0aa696911dc6b92ae470e6c63a9eabb6f918b879b82229163cbd5cfdd4a5fb1bb9af8b013702d492cd399818c3c1ad69e1b0927a43fee4237b8cf3b66a02d029aae3d544a9d7752ff35a4bb4d545662d8d68ec75a028244077e7f4b69ec4c76836bbfc9ee09bf3bf169b776322089c1693ac124083f89f820d0dd2a1625d59e4d5b12e098d57766bdb1cabddd8679921435d403166cbcf914b967268efdb78ad7969c96e93bf3ec3626c0754cb2f914807e314b9b6fed42c119860903a366ceda6c9095ecdffb9bfb8cc4cd0f5ab392430ab75891c94b774a7b994f59f71628fd9c33412fa88975aa5b4af7a0e1dc35f6368a9097d1ab37ff6c649d09ec53612a97776de3f89f16028d184073c423718f769bf8e2daf9077015b393df0db3d715048a34ccc8725ad0cf02018d050267756cc7cc20e7f96222877f25593c86d195c57c4f82567462a7692a18471eb9a18941e4eaca937be01f262e4d00210ac3d95124bd21905dfe1e0a875f94ca7e2a04c586e39580cdea9f26db9f06b817193f9d5f690c368ab0246ac0952c573e2dfadb253fc3f4c4190ab69d4c1b40da144f1f013034088727cd4d8af1a853ea4010ab28ca3137e1bb6bab3f909f18265fd519fed6425124100d70ac40dc35d899cb0f54fd2714d8ccf64df65ac6e2d51c4d4e3983c9a6bc2b04d3fab410246259506b9896f822e6a49c8a6447aea61492acb50d2e3014ecccef47b59748b7c1238f6814df5ac8d7412a08523683d14b57e05a87fad90fb118d1842cf5f50a2c71bcbdb1e5ac3287d22e947952f9b78cec0a0ff229383e455e930a93441956305088d4621a7310fd761133143aecc9a586834878ee7f3144e0091545f03ecae2e9145d86afbd35578ee05e2938fffa651354cdaea0363edc523212b62d419193a8a44d8c6a407d1f7470fd937f35c9a6edb297ae5349f516858a8154d95c5e0c270191d9e421b5dd25bc9e4b5271914c3f7a1bbd1e54f80fc291ef5f8e89f2cf0340eb37477096d1e94c38480cff5e2ce3fc831dc059986a71bb838f835c97c86ce84a1ccb91e00c4ce26dde9fd2cd76e3d725cadbd0775e1615d8af825dd16cb8a8660afa67a62ce3d514aba3078c074b9ddfef8ce87fd66f3112f45ba363a88d395e258078ae028534e6cbfd494ff8426de257ddccc585cfb0a95e450b03e19f03560dfff242b4ddf350f02169de4378aa0c3148eebf580530e45c81f9625d910e50043d8e345d772202dc03bb91a400d82622b317f396df9d50628cffaf97ccbbe0e9c0a43d2e460c90817e2605e028ef1a6df1dfbc757358576b21db16d0604d197d7d88f214d505b60cf3a9c90b11bcef4544ca628aa5606115111de64a0cc67056620309c3ae2d66e6ea64b3be59ea49c27f6726fcf50898faf7538e38d9cb96e6b168342a5fef446b0fdd94d9bda60c72254147d3dd39ad2be53c220d4dddd5d531ce6262853c71a9c4107555a1608b3993e8d43aa64fbb6ab3bcc7587fc9e30e0cbf5f76cae40b697d5b978b7388018336a1cd598d34a2344f8ad33a0bee0746bd02cf5c0d443dbfb679ea044e67aa255988c7835a88b590a9b206db8d2ae9161267447471cac3f547be96f6c42a34c8d224a1f3717c5580888abbd1a1bc6ef6f7140a156bd7371a1b5261b17b5e99e47258db8d553a9be4b221323eb57845a20a528a2122d3f8c48447eb8299ed41414eb3586556be5ddd5102687bd480c5a8de8ad27ef249672986579becf8d95937d4800e08de5e9819355c3d2b9ccc9c72ffd237343ebd8bb78aafc994db163aaa3d8fbc5b5cc3ae4546e797a25e363e307cdad2827b35a0b085699f2dc91bcb14368b734e4377dd2dc1e3fc95c634748002cc1da7a5bab03ca84e86ac8df4a31064ce82072a549740b4f713517bc8bdb0b720e2780f03ab8d1b138988b6ff04dccc94c3e1de1c2b01a3a9bfee8a4f1e8ddf6ba353c24084a61d3f99b246c1256284a9405aec6ef29cf92eda584e39c84d215ab89139833ecba4199b9723b8c56ceb36befcfab6900a0802122eacbe44f7d93731d3dabc6ca3d312e3e1484a4a23c26b6242c715e40e4860d2cb8b6b641a3b737317ab85f756ede2d0845296d91eddb92c3620ff1e515679a379bd64184a2a1a67402d8dc54d2e3a7436394fed0c16e502faabf595ea6ac82fbf6ace711e61868b5fbbed3dd6e4b6ca99b8134bfa3bf778cf71dcf962e599067bfce8d46548942151a905f2c66fe5bd3562fe6304bc93752563b182dd31d64abdeb0c0f127b1635a5200b56145339b3debf50e02f9cc52a6c46d04b1d5571c3addd75bec5e08208a266d894cad98b9fceccf11edf7e477c751d0e42807721aab6859a52a5838c2b401a5717576b00f8e3f93fd6c3c23a1614e8fb70a367e1f057469cfc3bd7e592981407e38632dc46cf36bb32cf2d02f6aa2e3df9cac828d9c92cbabcfcf75f40fa4cf2838a9fff696eba3c29ea554687daff5da87caf10c8aab6e7bcc2c89e40c2c7ddbf6c1a00549821fe0fbabadba518c6b1e9e9de69bcd88872d4f67dda453dd540223ff8605639a86e37ea11c205a13f65d3d85d64156e28c3c9a712455676b20670dad041cb85b9192bca8c8c6c6829a275cf9576d5154ac78bad596b778fb32e9bc07daddcc8e65f00b1fe41efe0849a6462c66dd38b94d7d135a7dcb418fe63ae5a5ba05c7a33b52342987bc1d180c722f90"
553
665
  }
554
666
  ],
555
667
  "refusals": [
package/gen-carrier.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  // Regenerates fixtures/carrier-v0.json, byte for byte, from the documented seeds below: the frames
3
- // of contract sigelo-carrier/0 (carrier.mjs header, "Frames"), kinds 1, 2, 4 and 5.
3
+ // of contract sigelo-carrier/0 (carrier.mjs header, "Frames"), kinds 1, 2, 4 (a rotation and a
4
+ // recovery) and 5.
4
5
  // node contact/gen-carrier.mjs write the file
5
6
  // node contact/gen-carrier.mjs --check exit 1 if the committed file differs
6
7
  // Independent of carrier.mjs, invite.mjs and prekeys.mjs on purpose: headers, keys, topics,
@@ -59,10 +60,12 @@ const frameOf = (kind, key, topic, plaintext, nonce) => concatBytes(head(kind),
59
60
  const derive = (ikm, salt, info, n) => hkdf(sha256, ikm, salt === null ? undefined : u8(salt), u8(info), n);
60
61
 
61
62
  export function build() {
62
- // Identities: alice (A0) invites, bob (B0) answers and later rotates to B1.
63
+ // Identities: alice (A0) invites, bob (B0) answers and later rotates to B1. Then B1 turns out to
64
+ // be a thief's: bob recovers from B0 to B2 with his recovery key, which beats B1 (SPEC §7.1).
63
65
  const [aRec, bRec] = ['A-recovery', 'B-recovery'].map((l) => id(l, ZERO).key);
64
- const A0 = id('A0', aRec), B0 = id('B0', bRec), B1 = id('B1', bRec);
66
+ const A0 = id('A0', aRec), B0 = id('B0', bRec), B1 = id('B1', bRec), B2 = id('B2', bRec);
65
67
  const rB1 = rotate({ genesis: B0.genesis, next_genesis: B1.genesis, iat: T0 + 100, reason: 'voluntary', secret: B0.secret });
68
+ const rB2 = rotate({ genesis: B0.genesis, next_genesis: B2.genesis, iat: T0 + 200, reason: 'recovery', secret: id('B-recovery', ZERO).secret });
66
69
 
67
70
  // The invite secret, alice's code and what they yield (contact/invite.mjs, sigelo-invite/0). Code:
68
71
  // version 1 | SHA-256(JCS(A0's genesis)) | secret | exp, u32 BE | relay length | relay | checksum =
@@ -112,6 +115,8 @@ export function build() {
112
115
  const prekeysKey = derive(K, 'sigelo-prekeys/0', `${B0.did}\n${A0.did}`, 32), noticeKey = derive(K, 'sigelo-notice/0', `${B0.did}\n${A0.did}`, 32);
113
116
  const noticeBody = { v: V, typ: 'contact-notice', did: B1.did, pair };
114
117
  const notice = { bundle: chainOf(B0.genesis, [rB1]), proof: { body: noticeBody, sig: sign(B1.secret, noticeBody) } };
118
+ const recoveredBody = { v: V, typ: 'contact-notice', did: B2.did, pair };
119
+ const noticeRecovered = { bundle: chainOf(B0.genesis, [rB1, rB2]), proof: { body: recoveredBody, sig: sign(B2.secret, recoveredBody) } };
115
120
 
116
121
  const frames = [];
117
122
  const counting = Uint8Array.from({ length: 24 }, (_, i) => i + 1);
@@ -128,6 +133,8 @@ export function build() {
128
133
  frame('reply', 2, 'invite.key', derive(secret, null, 'sigelo-invite/0 key', 32), invite.reply_topic, reply, 'alice\'s invite reply, her prekeys inside, on the reply topic');
129
134
  frame('prekeys', 5, 'prekeys_key', prekeysKey, mailbox, { prekeys: bundleOf(B0, 'bob prekeys', T0 + 40), want: false, known: A0.did }, 'bob\'s prekeys, his first frame after the reply, on his mailbox to alice; known: alice\'s current DID as he holds it');
130
135
  frame('notice', 4, 'notice_key', noticeKey, mailbox, notice, 'bob\'s contact notice after his rotation B0 -> B1: his chain, a proof signed by B1');
136
+ frame('notice_recovery', 4, 'notice_key', noticeKey, mailbox, noticeRecovered, 'bob\'s contact notice after his recovery B0 -> B2, which beats the thief\'s B0 -> B1: '
137
+ + 'a proof signed by B2. Alice, who followed B1, merges a recovery she had not followed: she marks bob re_pair "contact_recovery", since K may be the thief\'s, and sends him nothing more until a new pairing');
131
138
 
132
139
  // Refusals, in unseal's order: frame, aead, padding, plaintext, the same ten for each kind, so a
133
140
  // branch of one kind cannot pass what another refuses. Each frame is read as `read_as` under the
@@ -158,12 +165,13 @@ export function build() {
158
165
  + '`refusals`: opening `hex` as kind `read_as` under the generic key on `topic` fails with `error`, the first failing check. '
159
166
  + '`derived`: what the seeds yield, each from the formula beside it.',
160
167
  layout: 'version 0x01 (1) | kind (1) | 16 zero bytes | counter 1, u32 big-endian (4) | XChaCha20-Poly1305 nonce (24) | ciphertext + tag of pad(JCS(value)); additional data = the 22-byte header ‖ UTF-8 topic; pad: 0x80 then 0x00 to the next multiple of 256',
161
- kinds: { 1: 'invite answer (sigelo-invite/0), on the answer topic, key invite.key', 2: 'invite reply, on the reply topic, key invite.key', 4: 'contact notice {bundle: the chain, proof: {body: {v, typ: "contact-notice", did: the current DID, pair}, sig}}, on the mailbox topic, key notice_key', 5: 'prekeys {prekeys: a signed sigelo-msg/0 bundle, want: boolean, known: the receiver\'s current DID as the sender holds it}, on the mailbox topic, key prekeys_key' },
168
+ kinds: { 1: 'invite answer (sigelo-invite/0), on the answer topic, key invite.key', 2: 'invite reply, on the reply topic, key invite.key', 4: 'contact notice {bundle: the chain, proof: {body: {v, typ: "contact-notice", did: the current DID, pair}, sig}}, on the mailbox topic, key notice_key; a chain that brings a recovery the receiver had not followed burns K there (re_pair)', 5: 'prekeys {prekeys: a signed sigelo-msg/0 bundle, want: boolean, known: the receiver\'s current DID as the sender holds it}, on the mailbox topic, key prekeys_key' },
162
169
  checks: ['frame', 'aead', 'padding', 'plaintext'],
163
170
  created: CREATED, t0: T0,
164
- seeds: Object.fromEntries(['A0', 'A-recovery', 'B0', 'B1', 'B-recovery', 'invite secret', 'frame key'].map((l) => [l, hex(seed(l))])),
165
- identities: Object.fromEntries(Object.entries({ A0, B0, B1 }).map(([k, x]) => [k, { did: x.did, key: x.key, genesis: x.genesis }])),
171
+ seeds: Object.fromEntries(['A0', 'A-recovery', 'B0', 'B1', 'B2', 'B-recovery', 'invite secret', 'frame key'].map((l) => [l, hex(seed(l))])),
172
+ identities: Object.fromEntries(Object.entries({ A0, B0, B1, B2 }).map(([k, x]) => [k, { did: x.did, key: x.key, genesis: x.genesis }])),
166
173
  rotation: rB1,
174
+ recovery: rB2,
167
175
  derived: {
168
176
  invite,
169
177
  kem_pk: 'X-Wing keygen(rng("kem key") 32 bytes): the answer\'s kem_pk',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sigelo-contact",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "description": "Agent contacts for sigelo identities: invite codes, a contact store, end-to-end encrypted envelopes with hybrid post-quantum key agreement, and an MQTT carrier. Client code (MIT); the relay server is csigelo/sigelo-relay (AGPL-3.0).",
6
6
  "keywords": [
@@ -75,6 +75,6 @@
75
75
  "@noble/hashes": "^2.4.0",
76
76
  "@noble/post-quantum": "^0.7.1",
77
77
  "mqtt": "^5.16.0",
78
- "sigelo": "^0.1.2"
78
+ "sigelo": "^0.1.4"
79
79
  }
80
80
  }
package/store.mjs CHANGED
@@ -3,11 +3,13 @@
3
3
  // peer's ORIGINAL DID with every rotation seen, as accept/node/sigelo-pair.mjs keeps pairings, so
4
4
  // a rotation keeps the contact and a recovery still beats a thief (SPEC §7.1).
5
5
  // { v, self, invites: { nonce: { secret, exp, name, peer, relay } },
6
- // accepts: { answer id: { secret, code_did, exp, name, relay, kem_sk, as } },
7
- // contacts: { original DID: { name, did, current_did, current_key, revoked, chain, rotations, relay, pair_key } } }
6
+ // accepts: { answer id: { secret, code_did, exp, name, relay, kem_sk, as, named? } },
7
+ // contacts: { original DID: { name, did, current_did, current_key, revoked, chain, rotations, relay, pair_key, re_pair? } } }
8
8
  // invites: codes this owner handed out, keyed by inviteNonce(code bytes); peer: the original DID of
9
9
  // the contact a re-key code is for, null on a new contact's code. accepts: codes this owner
10
- // answered, keyed by answerId(answer). The file holds one-time secrets, Bob's one-time key and
10
+ // answered, keyed by answerId(answer). re_pair: "own_recovery" or "contact_recovery" once a recovery
11
+ // burned pair_key (carrier.mjs, "After a recovery"); a new pairing writes the record without it.
12
+ // The file holds one-time secrets, Bob's one-time key and
11
13
  // pairing keys, so it is written 0600. Two simultaneous writers still need the integrator's lock.
12
14
  import { randomBytes } from 'node:crypto';
13
15
  import { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
@@ -95,9 +97,10 @@ export class Contacts {
95
97
  * exactly as long as the pending answer: first reply, revoke, or expiry (at the next add or take).
96
98
  * as: the current DID his answer's chain ends at, which the inviter files him under; he may
97
99
  * rotate before the reply comes, and must then tell her (the carrier's rotation notice).
100
+ * named: he chose the name (accept --name), so a re-pair renames the known contact (the carrier).
98
101
  */
99
- addAccept(code, id, name, now, kem_sk = null, as = null) {
100
- return this.#add('accepts', id, { secret: hex(code.secret), code_did: code.did, exp: code.exp, name, relay: code.relay, kem_sk, as }, now, TTL_MAX + SKEW);
102
+ addAccept(code, id, name, now, kem_sk = null, as = null, named = false) {
103
+ return this.#add('accepts', id, { secret: hex(code.secret), code_did: code.did, exp: code.exp, name, relay: code.relay, kem_sk, as, ...(named && { named: true }) }, now, TTL_MAX + SKEW);
101
104
  }
102
105
 
103
106
  /** Single use: the entry is deleted, and the file saved, before any check runs on the message naming it. */