cojson 0.8.5 → 0.8.12

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/native/PeerKnownStates.js +63 -0
  3. package/dist/native/PeerKnownStates.js.map +1 -0
  4. package/dist/native/PeerState.js +5 -1
  5. package/dist/native/PeerState.js.map +1 -1
  6. package/dist/native/coValueState.js +74 -0
  7. package/dist/native/coValueState.js.map +1 -0
  8. package/dist/native/exports.js +39 -0
  9. package/dist/native/exports.js.map +1 -0
  10. package/dist/native/index.native.js +2 -39
  11. package/dist/native/index.native.js.map +1 -1
  12. package/dist/native/localNode.js +29 -51
  13. package/dist/native/localNode.js.map +1 -1
  14. package/dist/native/storage/index.js +2 -2
  15. package/dist/native/storage/index.js.map +1 -1
  16. package/dist/native/sync.js +89 -109
  17. package/dist/native/sync.js.map +1 -1
  18. package/dist/web/PeerKnownStates.js +63 -0
  19. package/dist/web/PeerKnownStates.js.map +1 -0
  20. package/dist/web/PeerState.js +5 -1
  21. package/dist/web/PeerState.js.map +1 -1
  22. package/dist/web/coValueState.js +74 -0
  23. package/dist/web/coValueState.js.map +1 -0
  24. package/dist/web/exports.js +39 -0
  25. package/dist/web/exports.js.map +1 -0
  26. package/dist/web/index.web.js +2 -39
  27. package/dist/web/index.web.js.map +1 -1
  28. package/dist/web/localNode.js +29 -51
  29. package/dist/web/localNode.js.map +1 -1
  30. package/dist/web/storage/index.js +2 -2
  31. package/dist/web/storage/index.js.map +1 -1
  32. package/dist/web/sync.js +89 -109
  33. package/dist/web/sync.js.map +1 -1
  34. package/package.json +1 -1
  35. package/src/PeerKnownStates.ts +108 -0
  36. package/src/PeerState.ts +8 -2
  37. package/src/coValueState.ts +107 -0
  38. package/src/exports.ts +149 -0
  39. package/src/index.native.ts +2 -152
  40. package/src/index.web.ts +2 -152
  41. package/src/localNode.ts +43 -90
  42. package/src/storage/index.ts +2 -2
  43. package/src/sync.ts +95 -148
  44. package/src/tests/PeerKnownStates.test.ts +100 -0
  45. package/src/tests/PeerState.test.ts +0 -11
  46. package/src/tests/sync.test.ts +2 -2
  47. package/.turbo/turbo-build.log +0 -16
  48. package/.turbo/turbo-lint.log +0 -4
  49. package/.turbo/turbo-test.log +0 -1001
@@ -0,0 +1,107 @@
1
+ import { CoValueCore } from "./coValueCore.js";
2
+ import { PeerID } from "./sync.js";
3
+
4
+ function createResolvablePromise<T>() {
5
+ let resolve!: (value: T) => void;
6
+
7
+ const promise = new Promise<T>((res) => {
8
+ resolve = res;
9
+ });
10
+
11
+ return { promise, resolve };
12
+ }
13
+
14
+ class CoValueUnknownState {
15
+ type = "unknown" as const;
16
+ private peers: Map<PeerID, ReturnType<typeof createResolvablePromise<"available" | "unavailable">>>;
17
+ private resolve: (value: "available" | "unavailable") => void;
18
+
19
+ ready: Promise<"available" | "unavailable">;
20
+
21
+ constructor(peersIds: Iterable<PeerID>) {
22
+ this.peers = new Map();
23
+
24
+ for (const peerId of peersIds) {
25
+ this.peers.set(peerId, createResolvablePromise<"available" | "unavailable">());
26
+ }
27
+
28
+ const { resolve, promise } = createResolvablePromise<"available" | "unavailable">();
29
+
30
+ this.ready = promise;
31
+ this.resolve = resolve;
32
+ }
33
+
34
+ update(peerId: PeerID, value: "available" | "unavailable") {
35
+ const entry = this.peers.get(peerId);
36
+
37
+ if (entry) {
38
+ entry.resolve(value);
39
+ }
40
+
41
+ if (value === "available") {
42
+ this.resolve("available");
43
+ return;
44
+ }
45
+
46
+ this.peers.delete(peerId);
47
+
48
+ // If none of the peers have the coValue, we resolve to unavailable
49
+ if (this.peers.size === 0) {
50
+ this.resolve("unavailable");
51
+ }
52
+ }
53
+
54
+ // Wait for a specific peer to have a known state
55
+ waitForPeer(peerId: PeerID) {
56
+ const entry = this.peers.get(peerId);
57
+
58
+ if (!entry) {
59
+ return Promise.resolve();
60
+ }
61
+
62
+ return entry.promise;
63
+ }
64
+ }
65
+
66
+ class CoValueAvailableState {
67
+ type = "available" as const;
68
+
69
+ constructor(public coValue: CoValueCore) { }
70
+ }
71
+
72
+ type CoValueStateAction = {
73
+ type: "not-found";
74
+ peerId: PeerID;
75
+ } | {
76
+ type: "found";
77
+ peerId: PeerID;
78
+ coValue: CoValueCore;
79
+ };
80
+
81
+ export class CoValueState {
82
+ constructor(public state: CoValueUnknownState | CoValueAvailableState) { }
83
+
84
+ static Unknown(peersToWaitFor: Set<PeerID>) {
85
+ return new CoValueState(new CoValueUnknownState(peersToWaitFor));
86
+ }
87
+
88
+ static Available(coValue: CoValueCore) {
89
+ return new CoValueState(new CoValueAvailableState(coValue));
90
+ }
91
+
92
+ dispatch(action: CoValueStateAction) {
93
+ if (this.state.type === "available") {
94
+ return;
95
+ }
96
+
97
+ switch (action.type) {
98
+ case "not-found":
99
+ this.state.update(action.peerId, "unavailable");
100
+ break;
101
+ case "found":
102
+ this.state.update(action.peerId, "available");
103
+ this.state = new CoValueAvailableState(action.coValue);
104
+ break;
105
+ }
106
+ }
107
+ }
package/src/exports.ts ADDED
@@ -0,0 +1,149 @@
1
+ import {
2
+ CoValueCore,
3
+ type CoValueUniqueness,
4
+ MAX_RECOMMENDED_TX_SIZE,
5
+ idforHeader,
6
+ } from "./coValueCore.js";
7
+ import { accountOrAgentIDfromSessionID } from "./typeUtils/accountOrAgentIDfromSessionID.js";
8
+ import { LocalNode } from "./localNode.js";
9
+ import { type RawCoValue } from "./coValue.js";
10
+ import { RawCoMap } from "./coValues/coMap.js";
11
+ import { RawCoList } from "./coValues/coList.js";
12
+ import { RawCoStream, RawBinaryCoStream } from "./coValues/coStream.js";
13
+ import {
14
+ secretSeedLength,
15
+ shortHashLength,
16
+ StreamingHash,
17
+ CryptoProvider,
18
+ } from "./crypto/crypto.js";
19
+ import { connectedPeers, Channel } from "./streamUtils.js";
20
+ import { ControlledAgent, RawControlledAccount } from "./coValues/account.js";
21
+ import type { Role } from "./permissions.js";
22
+ import { rawCoIDtoBytes, rawCoIDfromBytes, isRawCoID } from "./ids.js";
23
+ import { RawGroup, EVERYONE } from "./coValues/group.js";
24
+ import type { Everyone } from "./coValues/group.js";
25
+ import { base64URLtoBytes, bytesToBase64url } from "./base64url.js";
26
+ import { parseJSON } from "./jsonStringify.js";
27
+ import {
28
+ RawAccount,
29
+ RawProfile,
30
+ accountHeaderForInitialAgentSecret,
31
+ } from "./coValues/account.js";
32
+ import { expectGroup } from "./typeUtils/expectGroup.js";
33
+ import { isAccountID } from "./typeUtils/isAccountID.js";
34
+
35
+ import type { SessionID, AgentID } from "./ids.js";
36
+ import type { CoID, AnyRawCoValue } from "./coValue.js";
37
+ import type {
38
+ BinaryStreamInfo,
39
+ BinaryCoStreamMeta,
40
+ } from "./coValues/coStream.js";
41
+ import type { JsonValue } from "./jsonValue.js";
42
+ import type {
43
+ SyncMessage,
44
+ Peer,
45
+ IncomingSyncStream,
46
+ OutgoingSyncQueue,
47
+ } from "./sync.js";
48
+ import { DisconnectedError, PingTimeoutError } from "./sync.js";
49
+ import type { AgentSecret } from "./crypto/crypto.js";
50
+ import type {
51
+ RawAccountID,
52
+ AccountMeta,
53
+ RawAccountMigration,
54
+ } from "./coValues/account.js";
55
+ import type { InviteSecret } from "./coValues/group.js";
56
+ import type * as Media from "./media.js";
57
+
58
+ type Value = JsonValue | AnyRawCoValue;
59
+
60
+ import { LSMStorage, BlockFilename, WalFilename } from "./storage/index.js";
61
+ import { FileSystem } from "./storage/FileSystem.js";
62
+ import { getPriorityFromHeader } from "./priority.js";
63
+
64
+ /** @hidden */
65
+ export const cojsonInternals = {
66
+ connectedPeers,
67
+ rawCoIDtoBytes,
68
+ rawCoIDfromBytes,
69
+ secretSeedLength,
70
+ shortHashLength,
71
+ expectGroup,
72
+ base64URLtoBytes,
73
+ bytesToBase64url,
74
+ parseJSON,
75
+ accountOrAgentIDfromSessionID,
76
+ isAccountID,
77
+ accountHeaderForInitialAgentSecret,
78
+ idforHeader,
79
+ StreamingHash,
80
+ Channel,
81
+ getPriorityFromHeader,
82
+ };
83
+
84
+ export {
85
+ LocalNode,
86
+ RawGroup,
87
+ Role,
88
+ EVERYONE,
89
+ Everyone,
90
+ RawCoMap,
91
+ RawCoList,
92
+ RawCoStream,
93
+ RawBinaryCoStream,
94
+ RawCoValue,
95
+ CoID,
96
+ AnyRawCoValue,
97
+ RawAccount,
98
+ RawAccountID,
99
+ AccountMeta,
100
+ RawAccountMigration,
101
+ RawProfile as Profile,
102
+ SessionID,
103
+ Media,
104
+ CoValueCore,
105
+ ControlledAgent,
106
+ RawControlledAccount,
107
+ MAX_RECOMMENDED_TX_SIZE,
108
+ JsonValue,
109
+ Peer,
110
+ BinaryStreamInfo,
111
+ BinaryCoStreamMeta,
112
+ AgentID,
113
+ AgentSecret,
114
+ InviteSecret,
115
+ CryptoProvider,
116
+ SyncMessage,
117
+ isRawCoID,
118
+ LSMStorage,
119
+ };
120
+
121
+ export type {
122
+ Value,
123
+ FileSystem,
124
+ BlockFilename,
125
+ WalFilename,
126
+ IncomingSyncStream,
127
+ OutgoingSyncQueue,
128
+ DisconnectedError,
129
+ PingTimeoutError,
130
+ CoValueUniqueness,
131
+ };
132
+
133
+ // eslint-disable-next-line @typescript-eslint/no-namespace
134
+ export namespace CojsonInternalTypes {
135
+ export type CoValueKnownState = import("./sync.js").CoValueKnownState;
136
+ export type DoneMessage = import("./sync.js").DoneMessage;
137
+ export type KnownStateMessage = import("./sync.js").KnownStateMessage;
138
+ export type LoadMessage = import("./sync.js").LoadMessage;
139
+ export type NewContentMessage = import("./sync.js").NewContentMessage;
140
+ export type CoValueHeader = import("./coValueCore.js").CoValueHeader;
141
+ export type Transaction = import("./coValueCore.js").Transaction;
142
+ export type TransactionID = import("./ids.js").TransactionID;
143
+ export type Signature = import("./crypto/crypto.js").Signature;
144
+ export type RawCoID = import("./ids.js").RawCoID;
145
+ export type ProfileShape = import("./coValues/account.js").ProfileShape;
146
+ export type SealerSecret = import("./crypto/crypto.js").SealerSecret;
147
+ export type SignerSecret = import("./crypto/crypto.js").SignerSecret;
148
+ export type JsonObject = import("./jsonValue.js").JsonObject;
149
+ }
@@ -1,152 +1,2 @@
1
- import { PureJSCrypto } from "./crypto/PureJSCrypto.js";
2
-
3
- import {
4
- CoValueCore,
5
- type CoValueUniqueness,
6
- MAX_RECOMMENDED_TX_SIZE,
7
- idforHeader,
8
- } from "./coValueCore.js";
9
- import { accountOrAgentIDfromSessionID } from "./typeUtils/accountOrAgentIDfromSessionID.js";
10
- import { LocalNode } from "./localNode.js";
11
- import { type RawCoValue } from "./coValue.js";
12
- import { RawCoMap } from "./coValues/coMap.js";
13
- import { RawCoList } from "./coValues/coList.js";
14
- import { RawCoStream, RawBinaryCoStream } from "./coValues/coStream.js";
15
- import {
16
- secretSeedLength,
17
- shortHashLength,
18
- StreamingHash,
19
- CryptoProvider,
20
- } from "./crypto/crypto.js";
21
- import { connectedPeers, Channel } from "./streamUtils.js";
22
- import { ControlledAgent, RawControlledAccount } from "./coValues/account.js";
23
- import type { Role } from "./permissions.js";
24
- import { rawCoIDtoBytes, rawCoIDfromBytes, isRawCoID } from "./ids.js";
25
- import { RawGroup, EVERYONE } from "./coValues/group.js";
26
- import type { Everyone } from "./coValues/group.js";
27
- import { base64URLtoBytes, bytesToBase64url } from "./base64url.js";
28
- import { parseJSON } from "./jsonStringify.js";
29
- import {
30
- RawAccount,
31
- RawProfile,
32
- accountHeaderForInitialAgentSecret,
33
- } from "./coValues/account.js";
34
- import { expectGroup } from "./typeUtils/expectGroup.js";
35
- import { isAccountID } from "./typeUtils/isAccountID.js";
36
-
37
- import type { SessionID, AgentID } from "./ids.js";
38
- import type { CoID, AnyRawCoValue } from "./coValue.js";
39
- import type {
40
- BinaryStreamInfo,
41
- BinaryCoStreamMeta,
42
- } from "./coValues/coStream.js";
43
- import type { JsonValue } from "./jsonValue.js";
44
- import type {
45
- SyncMessage,
46
- Peer,
47
- IncomingSyncStream,
48
- OutgoingSyncQueue,
49
- } from "./sync.js";
50
- import { DisconnectedError, PingTimeoutError } from "./sync.js";
51
- import type { AgentSecret } from "./crypto/crypto.js";
52
- import type {
53
- RawAccountID,
54
- AccountMeta,
55
- RawAccountMigration,
56
- } from "./coValues/account.js";
57
- import type { InviteSecret } from "./coValues/group.js";
58
- import type * as Media from "./media.js";
59
-
60
- type Value = JsonValue | AnyRawCoValue;
61
-
62
- import { LSMStorage, BlockFilename, WalFilename } from "./storage/index.js";
63
- import { FileSystem } from "./storage/FileSystem.js";
64
- import { getPriorityFromHeader } from "./priority.js";
65
-
66
- /** @hidden */
67
- export const cojsonInternals = {
68
- connectedPeers,
69
- rawCoIDtoBytes,
70
- rawCoIDfromBytes,
71
- secretSeedLength,
72
- shortHashLength,
73
- expectGroup,
74
- base64URLtoBytes,
75
- bytesToBase64url,
76
- parseJSON,
77
- accountOrAgentIDfromSessionID,
78
- isAccountID,
79
- accountHeaderForInitialAgentSecret,
80
- idforHeader,
81
- StreamingHash,
82
- Channel,
83
- getPriorityFromHeader,
84
- };
85
-
86
- export {
87
- LocalNode,
88
- RawGroup,
89
- Role,
90
- EVERYONE,
91
- Everyone,
92
- RawCoMap,
93
- RawCoList,
94
- RawCoStream,
95
- RawBinaryCoStream,
96
- RawCoValue,
97
- CoID,
98
- AnyRawCoValue,
99
- RawAccount,
100
- RawAccountID,
101
- AccountMeta,
102
- RawAccountMigration,
103
- RawProfile as Profile,
104
- SessionID,
105
- Media,
106
- CoValueCore,
107
- ControlledAgent,
108
- RawControlledAccount,
109
- MAX_RECOMMENDED_TX_SIZE,
110
- JsonValue,
111
- Peer,
112
- BinaryStreamInfo,
113
- BinaryCoStreamMeta,
114
- AgentID,
115
- AgentSecret,
116
- InviteSecret,
117
- CryptoProvider,
118
- SyncMessage,
119
- isRawCoID,
120
- LSMStorage,
121
- PureJSCrypto,
122
- };
123
-
124
- export type {
125
- Value,
126
- FileSystem,
127
- BlockFilename,
128
- WalFilename,
129
- IncomingSyncStream,
130
- OutgoingSyncQueue,
131
- DisconnectedError,
132
- PingTimeoutError,
133
- CoValueUniqueness,
134
- };
135
-
136
- // eslint-disable-next-line @typescript-eslint/no-namespace
137
- export namespace CojsonInternalTypes {
138
- export type CoValueKnownState = import("./sync.js").CoValueKnownState;
139
- export type DoneMessage = import("./sync.js").DoneMessage;
140
- export type KnownStateMessage = import("./sync.js").KnownStateMessage;
141
- export type LoadMessage = import("./sync.js").LoadMessage;
142
- export type NewContentMessage = import("./sync.js").NewContentMessage;
143
- export type CoValueHeader = import("./coValueCore.js").CoValueHeader;
144
- export type Transaction = import("./coValueCore.js").Transaction;
145
- export type TransactionID = import("./ids.js").TransactionID;
146
- export type Signature = import("./crypto/crypto.js").Signature;
147
- export type RawCoID = import("./ids.js").RawCoID;
148
- export type ProfileShape = import("./coValues/account.js").ProfileShape;
149
- export type SealerSecret = import("./crypto/crypto.js").SealerSecret;
150
- export type SignerSecret = import("./crypto/crypto.js").SignerSecret;
151
- export type JsonObject = import("./jsonValue.js").JsonObject;
152
- }
1
+ export * from "./exports.js";
2
+ export { PureJSCrypto } from "./crypto/PureJSCrypto.js";
package/src/index.web.ts CHANGED
@@ -1,152 +1,2 @@
1
- import { WasmCrypto } from "./crypto/WasmCrypto.js";
2
-
3
- import {
4
- CoValueCore,
5
- type CoValueUniqueness,
6
- MAX_RECOMMENDED_TX_SIZE,
7
- idforHeader,
8
- } from "./coValueCore.js";
9
- import { accountOrAgentIDfromSessionID } from "./typeUtils/accountOrAgentIDfromSessionID.js";
10
- import { LocalNode } from "./localNode.js";
11
- import { type RawCoValue } from "./coValue.js";
12
- import { RawCoMap } from "./coValues/coMap.js";
13
- import { RawCoList } from "./coValues/coList.js";
14
- import { RawCoStream, RawBinaryCoStream } from "./coValues/coStream.js";
15
- import {
16
- secretSeedLength,
17
- shortHashLength,
18
- StreamingHash,
19
- CryptoProvider,
20
- } from "./crypto/crypto.js";
21
- import { connectedPeers, Channel } from "./streamUtils.js";
22
- import { ControlledAgent, RawControlledAccount } from "./coValues/account.js";
23
- import type { Role } from "./permissions.js";
24
- import { rawCoIDtoBytes, rawCoIDfromBytes, isRawCoID } from "./ids.js";
25
- import { RawGroup, EVERYONE } from "./coValues/group.js";
26
- import type { Everyone } from "./coValues/group.js";
27
- import { base64URLtoBytes, bytesToBase64url } from "./base64url.js";
28
- import { parseJSON } from "./jsonStringify.js";
29
- import {
30
- RawAccount,
31
- RawProfile,
32
- accountHeaderForInitialAgentSecret,
33
- } from "./coValues/account.js";
34
- import { expectGroup } from "./typeUtils/expectGroup.js";
35
- import { isAccountID } from "./typeUtils/isAccountID.js";
36
-
37
- import type { SessionID, AgentID } from "./ids.js";
38
- import type { CoID, AnyRawCoValue } from "./coValue.js";
39
- import type {
40
- BinaryStreamInfo,
41
- BinaryCoStreamMeta,
42
- } from "./coValues/coStream.js";
43
- import type { JsonValue } from "./jsonValue.js";
44
- import type {
45
- SyncMessage,
46
- Peer,
47
- IncomingSyncStream,
48
- OutgoingSyncQueue,
49
- } from "./sync.js";
50
- import { DisconnectedError, PingTimeoutError } from "./sync.js";
51
- import type { AgentSecret } from "./crypto/crypto.js";
52
- import type {
53
- RawAccountID,
54
- AccountMeta,
55
- RawAccountMigration,
56
- } from "./coValues/account.js";
57
- import type { InviteSecret } from "./coValues/group.js";
58
- import type * as Media from "./media.js";
59
-
60
- type Value = JsonValue | AnyRawCoValue;
61
-
62
- import { LSMStorage, BlockFilename, WalFilename } from "./storage/index.js";
63
- import { FileSystem } from "./storage/FileSystem.js";
64
- import { getPriorityFromHeader } from "./priority.js";
65
-
66
- /** @hidden */
67
- export const cojsonInternals = {
68
- connectedPeers,
69
- rawCoIDtoBytes,
70
- rawCoIDfromBytes,
71
- secretSeedLength,
72
- shortHashLength,
73
- expectGroup,
74
- base64URLtoBytes,
75
- bytesToBase64url,
76
- parseJSON,
77
- accountOrAgentIDfromSessionID,
78
- isAccountID,
79
- accountHeaderForInitialAgentSecret,
80
- idforHeader,
81
- StreamingHash,
82
- Channel,
83
- getPriorityFromHeader,
84
- };
85
-
86
- export {
87
- LocalNode,
88
- RawGroup,
89
- Role,
90
- EVERYONE,
91
- Everyone,
92
- RawCoMap,
93
- RawCoList,
94
- RawCoStream,
95
- RawBinaryCoStream,
96
- RawCoValue,
97
- CoID,
98
- AnyRawCoValue,
99
- RawAccount,
100
- RawAccountID,
101
- AccountMeta,
102
- RawAccountMigration,
103
- RawProfile as Profile,
104
- SessionID,
105
- Media,
106
- CoValueCore,
107
- ControlledAgent,
108
- RawControlledAccount,
109
- MAX_RECOMMENDED_TX_SIZE,
110
- JsonValue,
111
- Peer,
112
- BinaryStreamInfo,
113
- BinaryCoStreamMeta,
114
- AgentID,
115
- AgentSecret,
116
- InviteSecret,
117
- CryptoProvider,
118
- SyncMessage,
119
- isRawCoID,
120
- LSMStorage,
121
- WasmCrypto,
122
- };
123
-
124
- export type {
125
- Value,
126
- FileSystem,
127
- BlockFilename,
128
- WalFilename,
129
- IncomingSyncStream,
130
- OutgoingSyncQueue,
131
- DisconnectedError,
132
- PingTimeoutError,
133
- CoValueUniqueness,
134
- };
135
-
136
- // eslint-disable-next-line @typescript-eslint/no-namespace
137
- export namespace CojsonInternalTypes {
138
- export type CoValueKnownState = import("./sync.js").CoValueKnownState;
139
- export type DoneMessage = import("./sync.js").DoneMessage;
140
- export type KnownStateMessage = import("./sync.js").KnownStateMessage;
141
- export type LoadMessage = import("./sync.js").LoadMessage;
142
- export type NewContentMessage = import("./sync.js").NewContentMessage;
143
- export type CoValueHeader = import("./coValueCore.js").CoValueHeader;
144
- export type Transaction = import("./coValueCore.js").Transaction;
145
- export type TransactionID = import("./ids.js").TransactionID;
146
- export type Signature = import("./crypto/crypto.js").Signature;
147
- export type RawCoID = import("./ids.js").RawCoID;
148
- export type ProfileShape = import("./coValues/account.js").ProfileShape;
149
- export type SealerSecret = import("./crypto/crypto.js").SealerSecret;
150
- export type SignerSecret = import("./crypto/crypto.js").SignerSecret;
151
- export type JsonObject = import("./jsonValue.js").JsonObject;
152
- }
1
+ export * from "./exports.js";
2
+ export { WasmCrypto } from "./crypto/WasmCrypto.js";