sealnet 1.3.0 → 1.4.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.
package/dist/index.js CHANGED
@@ -2101,7 +2101,7 @@ var seal_address_v1_default = {
2101
2101
  address: {
2102
2102
  key: "X25519 public key, 32 bytes",
2103
2103
  text: "base64url without padding, 43 characters",
2104
- emoji: "fingerprint_emoji.json over sha256(key)[0..3], the same picture as intake",
2104
+ words: "fingerprint_words.json over sha256(key)[0..3]: three words, the same as intake shows",
2105
2105
  inbox_hash: "sha256(key), 32 bytes: the server finds an inbox by it"
2106
2106
  },
2107
2107
  box_origin: "https://box.seal.net",
@@ -2750,6 +2750,22 @@ var SealApi = class _SealApi {
2750
2750
  signal: opts.signal
2751
2751
  });
2752
2752
  }
2753
+ /** `GET /intake/push-key` — the VAPID key a browser subscribes an inbox's push with (F3 §8). */
2754
+ async pushKey(opts = {}) {
2755
+ const resp = await this.request("/intake/push-key", { what: "GET /intake/push-key", signal: opts.signal });
2756
+ return (await resp.json()).vapid_public;
2757
+ }
2758
+ /** `POST|DELETE /intake/subscriptions` — push `endpoint` when the proven inbox gets something, or stop. */
2759
+ async setInboxPush(endpoint, on, proof, opts = {}) {
2760
+ const method = on ? "POST" : "DELETE";
2761
+ await this.request("/intake/subscriptions", {
2762
+ what: `${method} /intake/subscriptions`,
2763
+ method,
2764
+ headers: { "Content-Type": "application/json", ...proofHeaders(proof) },
2765
+ body: JSON.stringify({ to: proof.address, endpoint }),
2766
+ signal: opts.signal
2767
+ });
2768
+ }
2753
2769
  };
2754
2770
  var NOT_READY_DEFAULT_RETRY_AFTER_S = 3;
2755
2771
  function proofHeaders(proof) {
@@ -5448,7 +5464,7 @@ async function proveAddress(secret, challenge, ts) {
5448
5464
  var fingerprint_emoji_default = {
5449
5465
  version: 1,
5450
5466
  name: "FINGERPRINT_EMOJI",
5451
- description: "Three emoji that name an X25519 public key to a person (SPEC-AGENTS \xA74.2): emoji i (i = 0, 1, 2) is emoji[byte i of SHA-256(public key)], 24 bits in all. The agent shows them in the chat and seal.net/i/{id} shows them under the form, so a person sees at a glance whether the page is sealing to the agent they talk to. One list for every language and client; each entry is a single code point with default emoji presentation (no variation selector, no ZWJ). Built from the code-point ranges below, in that order.",
5467
+ description: "LEGACY: the fingerprint of clients released before SPEC-ADDRESS F7 (sealnet-mcp 0.6, CLI 1.5, sealnet 1.3); the current one is fingerprint_words.json. Kept for the web's note on older agents and for the deprecated `emoji` fields of the published SDK, Python and CLI JSON. Three emoji that name an X25519 public key to a person (SPEC-AGENTS \xA74.2): emoji i (i = 0, 1, 2) is emoji[byte i of SHA-256(public key)], 24 bits in all. The agent shows them in the chat and seal.net/i/{id} shows them under the form, so a person sees at a glance whether the page is sealing to the agent they talk to. One list for every language and client; each entry is a single code point with default emoji presentation (no variation selector, no ZWJ). Built from the code-point ranges below, in that order.",
5452
5468
  construction: {
5453
5469
  ranges: [
5454
5470
  [
@@ -5753,11 +5769,285 @@ var fingerprint_emoji_default = {
5753
5769
  "\u{1F31F}"
5754
5770
  ]
5755
5771
  };
5756
- var EMOJI = fingerprint_emoji_default.emoji;
5757
- var COUNT = fingerprint_emoji_default.count;
5772
+ var fingerprint_words_default = {
5773
+ version: 1,
5774
+ name: "FINGERPRINT_WORDS",
5775
+ description: "Three words that name an X25519 public key to a person (SPEC-ADDRESS F7, which replaced the emoji of SPEC-AGENTS \xA74.2): word i (i = 0, 1, 2) is words[byte i of SHA-256(public key)], 24 bits in all, written in lower case with one space between them. The agent shows them in its chat, box.seal.net and seal.net/i/{id} show them on the page, so a person sees at a glance whether both sides hold the same key. One list for every language and client: 256 English nouns of 3 to 7 letters, no two sharing their first three letters, in alphabetical order.",
5776
+ digest: "sha256",
5777
+ count: 3,
5778
+ separator: " ",
5779
+ words: [
5780
+ "acorn",
5781
+ "album",
5782
+ "amber",
5783
+ "anchor",
5784
+ "apple",
5785
+ "arrow",
5786
+ "atlas",
5787
+ "bamboo",
5788
+ "banjo",
5789
+ "basket",
5790
+ "beach",
5791
+ "bell",
5792
+ "bench",
5793
+ "berry",
5794
+ "birch",
5795
+ "bison",
5796
+ "bloom",
5797
+ "boat",
5798
+ "bolt",
5799
+ "bottle",
5800
+ "brick",
5801
+ "broom",
5802
+ "butter",
5803
+ "cabin",
5804
+ "cactus",
5805
+ "camel",
5806
+ "candle",
5807
+ "cargo",
5808
+ "castle",
5809
+ "cedar",
5810
+ "cherry",
5811
+ "clock",
5812
+ "coast",
5813
+ "comet",
5814
+ "copper",
5815
+ "coral",
5816
+ "cotton",
5817
+ "crab",
5818
+ "crown",
5819
+ "daisy",
5820
+ "dawn",
5821
+ "deer",
5822
+ "delta",
5823
+ "desert",
5824
+ "diamond",
5825
+ "dolphin",
5826
+ "dove",
5827
+ "dragon",
5828
+ "drum",
5829
+ "duck",
5830
+ "dune",
5831
+ "eagle",
5832
+ "earth",
5833
+ "echo",
5834
+ "egg",
5835
+ "elk",
5836
+ "ember",
5837
+ "emerald",
5838
+ "engine",
5839
+ "falcon",
5840
+ "farm",
5841
+ "feather",
5842
+ "fence",
5843
+ "fern",
5844
+ "fig",
5845
+ "finch",
5846
+ "fish",
5847
+ "flag",
5848
+ "flute",
5849
+ "fog",
5850
+ "forest",
5851
+ "fossil",
5852
+ "fox",
5853
+ "frog",
5854
+ "garden",
5855
+ "gate",
5856
+ "gazelle",
5857
+ "gecko",
5858
+ "geyser",
5859
+ "ginger",
5860
+ "giraffe",
5861
+ "glacier",
5862
+ "globe",
5863
+ "goat",
5864
+ "gold",
5865
+ "goose",
5866
+ "grape",
5867
+ "guitar",
5868
+ "hammer",
5869
+ "harbor",
5870
+ "hawk",
5871
+ "hazel",
5872
+ "hedge",
5873
+ "heron",
5874
+ "hill",
5875
+ "hippo",
5876
+ "hive",
5877
+ "honey",
5878
+ "horse",
5879
+ "igloo",
5880
+ "iguana",
5881
+ "iris",
5882
+ "iron",
5883
+ "island",
5884
+ "ivory",
5885
+ "jacket",
5886
+ "jaguar",
5887
+ "jasmine",
5888
+ "jelly",
5889
+ "jewel",
5890
+ "juice",
5891
+ "jungle",
5892
+ "kayak",
5893
+ "kelp",
5894
+ "kettle",
5895
+ "kite",
5896
+ "kiwi",
5897
+ "koala",
5898
+ "ladder",
5899
+ "lagoon",
5900
+ "lamp",
5901
+ "lantern",
5902
+ "lava",
5903
+ "leaf",
5904
+ "lemon",
5905
+ "leopard",
5906
+ "lily",
5907
+ "lime",
5908
+ "lion",
5909
+ "lizard",
5910
+ "llama",
5911
+ "lobster",
5912
+ "lotus",
5913
+ "lynx",
5914
+ "magnet",
5915
+ "mango",
5916
+ "maple",
5917
+ "marble",
5918
+ "meadow",
5919
+ "melon",
5920
+ "meteor",
5921
+ "mint",
5922
+ "mirror",
5923
+ "monkey",
5924
+ "moon",
5925
+ "mosaic",
5926
+ "muffin",
5927
+ "nail",
5928
+ "nectar",
5929
+ "needle",
5930
+ "nest",
5931
+ "oasis",
5932
+ "ocean",
5933
+ "olive",
5934
+ "opal",
5935
+ "orange",
5936
+ "orbit",
5937
+ "orchid",
5938
+ "otter",
5939
+ "owl",
5940
+ "palm",
5941
+ "panda",
5942
+ "paper",
5943
+ "parrot",
5944
+ "peach",
5945
+ "pebble",
5946
+ "pelican",
5947
+ "pencil",
5948
+ "pepper",
5949
+ "piano",
5950
+ "pine",
5951
+ "pizza",
5952
+ "planet",
5953
+ "plum",
5954
+ "pony",
5955
+ "poppy",
5956
+ "prism",
5957
+ "pumpkin",
5958
+ "quartz",
5959
+ "queen",
5960
+ "quill",
5961
+ "rabbit",
5962
+ "radio",
5963
+ "raft",
5964
+ "raven",
5965
+ "reed",
5966
+ "rhino",
5967
+ "ribbon",
5968
+ "ridge",
5969
+ "river",
5970
+ "robin",
5971
+ "rocket",
5972
+ "rose",
5973
+ "ruby",
5974
+ "sail",
5975
+ "salmon",
5976
+ "sand",
5977
+ "saturn",
5978
+ "scroll",
5979
+ "shark",
5980
+ "shell",
5981
+ "ship",
5982
+ "silk",
5983
+ "sled",
5984
+ "sloth",
5985
+ "snail",
5986
+ "snow",
5987
+ "spider",
5988
+ "spruce",
5989
+ "star",
5990
+ "stone",
5991
+ "sugar",
5992
+ "summit",
5993
+ "swan",
5994
+ "table",
5995
+ "teapot",
5996
+ "thunder",
5997
+ "tiger",
5998
+ "tile",
5999
+ "timber",
6000
+ "toast",
6001
+ "tomato",
6002
+ "topaz",
6003
+ "torch",
6004
+ "tower",
6005
+ "trout",
6006
+ "truck",
6007
+ "tulip",
6008
+ "turtle",
6009
+ "unicorn",
6010
+ "valley",
6011
+ "vanilla",
6012
+ "vase",
6013
+ "velvet",
6014
+ "violin",
6015
+ "volcano",
6016
+ "wagon",
6017
+ "walnut",
6018
+ "wave",
6019
+ "whale",
6020
+ "wheat",
6021
+ "whistle",
6022
+ "willow",
6023
+ "window",
6024
+ "wizard",
6025
+ "wolf",
6026
+ "wombat",
6027
+ "wren",
6028
+ "yacht",
6029
+ "yarn",
6030
+ "yeti",
6031
+ "yucca",
6032
+ "zebra",
6033
+ "zenith",
6034
+ "zinc",
6035
+ "zipper"
6036
+ ],
6037
+ vector: {
6038
+ public_key_b64url: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
6039
+ sha256_prefix_hex: "66687a",
6040
+ words: "iron ivory lava"
6041
+ }
6042
+ };
6043
+ var WORDS = fingerprint_words_default.words;
6044
+ function keyWords(publicKey) {
6045
+ const digest = sha2563(publicKey);
6046
+ return Array.from(digest.subarray(0, fingerprint_words_default.count), (byte) => WORDS[byte]).join(fingerprint_words_default.separator);
6047
+ }
5758
6048
  function keyEmoji(publicKey) {
5759
6049
  const digest = sha2563(publicKey);
5760
- return Array.from(digest.subarray(0, COUNT), (byte) => EMOJI[byte]).join("");
6050
+ return Array.from(digest.subarray(0, fingerprint_emoji_default.count), (byte) => fingerprint_emoji_default.emoji[byte]).join("");
5761
6051
  }
5762
6052
  var PAIRING_MIME = seal_address_v1_default.payloads.pair.mime;
5763
6053
  var DEVICE_MIME = seal_address_v1_default.payloads.device.mime;
@@ -6571,6 +6861,7 @@ async function requestIntake(api, siteOrigin, opts) {
6571
6861
  return {
6572
6862
  intakeId: intake.id,
6573
6863
  url: `${siteOrigin}/i/${intake.id}`,
6864
+ words: keyWords(base64urlToBytes(opts.recipientKey)),
6574
6865
  emoji: keyEmoji(base64urlToBytes(opts.recipientKey)),
6575
6866
  expiresAt: intake.expires_at
6576
6867
  };
@@ -6609,6 +6900,7 @@ async function pairWith(api, siteOrigin, opts) {
6609
6900
  };
6610
6901
  return {
6611
6902
  url: `${siteOrigin}/i/${intake.id}`,
6903
+ words: keyWords(base64urlToBytes(opts.keyPair.publicKey)),
6612
6904
  emoji: keyEmoji(base64urlToBytes(opts.keyPair.publicKey)),
6613
6905
  expiresAt: intake.expires_at,
6614
6906
  wait
@@ -6635,6 +6927,7 @@ async function inboxOf(api, opts) {
6635
6927
  version: wire.version,
6636
6928
  items: wire.items.map((i) => ({
6637
6929
  id: i.id,
6930
+ fromWords: i.sender === null ? null : keyWords(base64urlToBytes(i.sender)),
6638
6931
  from: i.sender === null ? null : keyEmoji(base64urlToBytes(i.sender)),
6639
6932
  label: i.label,
6640
6933
  receivedAt: i.at,
@@ -6729,7 +7022,7 @@ var SealClient = class {
6729
7022
  }
6730
7023
  /**
6731
7024
  * Connect your key to a person's SEAL inbox, once: show them `url` and
6732
- * `emoji`, then `wait()` gives their inbox's address. Pass it as `owner` to
7025
+ * `words`, then `wait()` gives their inbox's address. Pass it as `owner` to
6733
7026
  * {@link SealClient.send} (every seal lands in their inbox) or as `to` to
6734
7027
  * {@link SealClient.request} (the request waits there).
6735
7028
  */
@@ -6748,7 +7041,7 @@ var SealClient = class {
6748
7041
  return this.seals.revoke(sealId, ownerToken, options);
6749
7042
  }
6750
7043
  };
6751
- var VERSION2 = "1.3.0";
7044
+ var VERSION2 = "1.4.0";
6752
7045
  export {
6753
7046
  SealClient,
6754
7047
  SealError,