@peers-app/peers-sdk 0.23.14 → 0.25.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/context/user-context.d.ts +8 -0
- package/dist/context/user-context.js +9 -1
- package/dist/contracts/index.d.ts +1 -0
- package/dist/contracts/index.js +4 -1
- package/dist/contracts/system/index.d.ts +2 -0
- package/dist/contracts/system/index.js +5 -1
- package/dist/contracts/system/invites-contract.d.ts +121 -0
- package/dist/contracts/system/invites-contract.js +150 -0
- package/dist/data/create-group.d.ts +24 -0
- package/dist/data/create-group.js +61 -0
- package/dist/data/group-secret.d.ts +10 -0
- package/dist/data/group-secret.js +26 -0
- package/dist/data/group-share.d.ts +0 -20
- package/dist/data/group-share.js +0 -35
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.js +2 -0
- package/dist/data/invites.d.ts +350 -0
- package/dist/data/invites.js +99 -0
- package/dist/data/orm/data-query.d.ts +1 -0
- package/dist/data/orm/sql.data-source.d.ts +3 -2
- package/dist/data/orm/sql.data-source.js +5 -3
- package/dist/data/orm/subscribable.data-source.d.ts +3 -2
- package/dist/data/orm/subscribable.data-source.js +7 -11
- package/dist/data/users.d.ts +11 -0
- package/dist/data/users.js +17 -0
- package/dist/device/device-election.d.ts +23 -3
- package/dist/device/device-election.js +15 -0
- package/dist/device/device-election.test.js +73 -0
- package/dist/device-pairing/constants.d.ts +27 -9
- package/dist/device-pairing/constants.js +28 -10
- package/dist/device-pairing/cpace.d.ts +46 -0
- package/dist/device-pairing/cpace.js +173 -0
- package/dist/device-pairing/cpace.test.js +116 -0
- package/dist/device-pairing/crypto.d.ts +40 -15
- package/dist/device-pairing/crypto.js +74 -33
- package/dist/device-pairing/device-pairing.test.js +156 -119
- package/dist/device-pairing/index.d.ts +3 -1
- package/dist/device-pairing/index.js +3 -1
- package/dist/device-pairing/pairing-code.d.ts +27 -0
- package/dist/device-pairing/pairing-code.js +84 -0
- package/dist/device-pairing/pgp-word-list.d.ts +14 -0
- package/dist/device-pairing/pgp-word-list.js +531 -0
- package/dist/device-pairing/signaling.d.ts +17 -6
- package/dist/device-pairing/signaling.js +31 -8
- package/dist/device-pairing/transcript.d.ts +3 -3
- package/dist/device-pairing/transcript.js +6 -13
- package/dist/device-pairing/types.d.ts +870 -224
- package/dist/device-pairing/types.js +186 -108
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/invites/data-box-schema.d.ts +15 -0
- package/dist/invites/data-box-schema.js +15 -0
- package/dist/invites/group-approval.d.ts +43 -0
- package/dist/invites/group-approval.js +155 -0
- package/dist/invites/group-approval.test.js +221 -0
- package/dist/invites/index.d.ts +5 -0
- package/dist/{group-invite → invites}/index.js +5 -3
- package/dist/invites/invite-epoch.d.ts +18 -0
- package/dist/invites/invite-epoch.js +35 -0
- package/dist/invites/invite-messages.d.ts +1354 -0
- package/dist/invites/invite-messages.js +145 -0
- package/dist/invites/invite-token.d.ts +334 -0
- package/dist/invites/invite-token.js +178 -0
- package/dist/invites/invite-token.test.d.ts +1 -0
- package/dist/invites/invite-token.test.js +123 -0
- package/dist/keys.d.ts +17 -1
- package/dist/keys.js +58 -5
- package/dist/keys.test.js +113 -0
- package/dist/rpc-types.d.ts +5 -4
- package/dist/rpc-types.js +2 -1
- package/dist/serial-json.d.ts +4 -1
- package/dist/serial-json.js +4 -1
- package/dist/system-ids.d.ts +22 -0
- package/dist/system-ids.js +23 -1
- package/package.json +1 -1
- package/dist/device-pairing/invitation.d.ts +0 -13
- package/dist/device-pairing/invitation.js +0 -85
- package/dist/group-invite/group-invite.d.ts +0 -53
- package/dist/group-invite/group-invite.js +0 -231
- package/dist/group-invite/group-invite.pvars.d.ts +0 -94
- package/dist/group-invite/group-invite.pvars.js +0 -139
- package/dist/group-invite/group-invite.types.d.ts +0 -124
- package/dist/group-invite/group-invite.types.js +0 -8
- package/dist/group-invite/index.d.ts +0 -3
- package/dist/user-connect/connection-code.d.ts +0 -67
- package/dist/user-connect/connection-code.js +0 -176
- package/dist/user-connect/connection-code.test.js +0 -213
- package/dist/user-connect/index.d.ts +0 -3
- package/dist/user-connect/index.js +0 -19
- package/dist/user-connect/user-connect.pvars.d.ts +0 -20
- package/dist/user-connect/user-connect.pvars.js +0 -63
- package/dist/user-connect/user-connect.pvars.test.js +0 -46
- package/dist/user-connect/user-connect.types.d.ts +0 -94
- package/dist/user-connect/user-connect.types.js +0 -68
- /package/dist/{user-connect/connection-code.test.d.ts → device-pairing/cpace.test.d.ts} +0 -0
- /package/dist/{user-connect/user-connect.pvars.test.d.ts → invites/group-approval.test.d.ts} +0 -0
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types for the user connection flow.
|
|
3
|
-
*
|
|
4
|
-
* This flow allows two users to securely exchange user information
|
|
5
|
-
* using a 12-character code (4-char rendezvous alias + 8-char shared secret).
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Stable protocol error codes for the user-connect exchange.
|
|
9
|
-
* The UI owns presentation text; the device layer reports these codes.
|
|
10
|
-
*/
|
|
11
|
-
export type UserConnectErrorCode = "invalid-code" | "no-route" | "not-found-or-expired" | "remote-not-waiting" | "canceled" | "protocol-error";
|
|
12
|
-
/**
|
|
13
|
-
* Discriminated status published by the device layer during a user-connect ceremony.
|
|
14
|
-
*/
|
|
15
|
-
export type UserConnectStatus = {
|
|
16
|
-
kind: "idle";
|
|
17
|
-
} | {
|
|
18
|
-
kind: "offer-registering";
|
|
19
|
-
} | {
|
|
20
|
-
kind: "offer-ready";
|
|
21
|
-
} | {
|
|
22
|
-
kind: "connecting";
|
|
23
|
-
attempt: number;
|
|
24
|
-
} | {
|
|
25
|
-
kind: "connected";
|
|
26
|
-
remoteUserId: string;
|
|
27
|
-
remoteDeviceId: string;
|
|
28
|
-
} | {
|
|
29
|
-
kind: "error";
|
|
30
|
-
code: UserConnectErrorCode;
|
|
31
|
-
detail?: string;
|
|
32
|
-
};
|
|
33
|
-
/** Default idle status for a quiet connection ceremony. */
|
|
34
|
-
export declare const USER_CONNECT_IDLE_STATUS: UserConnectStatus;
|
|
35
|
-
/**
|
|
36
|
-
* Normalize a persisted or in-memory status value to the structured shape.
|
|
37
|
-
* Clears legacy string statuses (`""`, `"Error: …"`, bare user IDs) to idle so
|
|
38
|
-
* callers never treat stale strings as protocol facts.
|
|
39
|
-
* @param value Raw pvar value
|
|
40
|
-
* @returns A valid {@link UserConnectStatus}
|
|
41
|
-
*/
|
|
42
|
-
export declare function normalizeUserConnectStatus(value: unknown): UserConnectStatus;
|
|
43
|
-
/**
|
|
44
|
-
* User information exchanged during the connection flow.
|
|
45
|
-
*/
|
|
46
|
-
export interface IUserConnectInfo {
|
|
47
|
-
userId: string;
|
|
48
|
-
name?: string;
|
|
49
|
-
publicKey: string;
|
|
50
|
-
publicBoxKey: string;
|
|
51
|
-
deviceId: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Message sent by the responder to initiate the connection.
|
|
55
|
-
* The payload is encrypted with the shared secret from the connection code.
|
|
56
|
-
*/
|
|
57
|
-
export interface IUserConnectRequest {
|
|
58
|
-
type: "user-connect-request";
|
|
59
|
-
/** User info encrypted with the shared secret */
|
|
60
|
-
encryptedUserInfo: string;
|
|
61
|
-
/** The responder's deviceId so the initiator can respond directly */
|
|
62
|
-
responseDeviceId: string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Message sent by the initiator in response to a connection request.
|
|
66
|
-
* The payload is encrypted with the shared secret.
|
|
67
|
-
*/
|
|
68
|
-
export interface IUserConnectResponse {
|
|
69
|
-
type: "user-connect-response";
|
|
70
|
-
/** User info encrypted with the shared secret */
|
|
71
|
-
encryptedUserInfo: string;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Message broadcast to register a short-lived device alias.
|
|
75
|
-
* Other devices store this mapping for routing purposes.
|
|
76
|
-
*/
|
|
77
|
-
export interface IDeviceAliasMessage {
|
|
78
|
-
type: "device-alias";
|
|
79
|
-
/** The short alias (4 chars Crockford Base32) */
|
|
80
|
-
alias: string;
|
|
81
|
-
/** The actual deviceId this alias maps to */
|
|
82
|
-
deviceId: string;
|
|
83
|
-
/** TTL in milliseconds (typically 10 minutes) */
|
|
84
|
-
ttlMs: number;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Result of a successful user connection.
|
|
88
|
-
*/
|
|
89
|
-
export interface IUserConnectResult {
|
|
90
|
-
/** The remote user's information */
|
|
91
|
-
remoteUser: IUserConnectInfo;
|
|
92
|
-
/** Confirmation hash (first 4 chars) for visual verification */
|
|
93
|
-
confirmationHash: string;
|
|
94
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Types for the user connection flow.
|
|
4
|
-
*
|
|
5
|
-
* This flow allows two users to securely exchange user information
|
|
6
|
-
* using a 12-character code (4-char rendezvous alias + 8-char shared secret).
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.USER_CONNECT_IDLE_STATUS = void 0;
|
|
10
|
-
exports.normalizeUserConnectStatus = normalizeUserConnectStatus;
|
|
11
|
-
/** Default idle status for a quiet connection ceremony. */
|
|
12
|
-
exports.USER_CONNECT_IDLE_STATUS = { kind: "idle" };
|
|
13
|
-
/**
|
|
14
|
-
* Normalize a persisted or in-memory status value to the structured shape.
|
|
15
|
-
* Clears legacy string statuses (`""`, `"Error: …"`, bare user IDs) to idle so
|
|
16
|
-
* callers never treat stale strings as protocol facts.
|
|
17
|
-
* @param value Raw pvar value
|
|
18
|
-
* @returns A valid {@link UserConnectStatus}
|
|
19
|
-
*/
|
|
20
|
-
function normalizeUserConnectStatus(value) {
|
|
21
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
22
|
-
return exports.USER_CONNECT_IDLE_STATUS;
|
|
23
|
-
}
|
|
24
|
-
const candidate = value;
|
|
25
|
-
switch (candidate.kind) {
|
|
26
|
-
case "idle":
|
|
27
|
-
case "offer-registering":
|
|
28
|
-
case "offer-ready":
|
|
29
|
-
return { kind: candidate.kind };
|
|
30
|
-
case "connecting": {
|
|
31
|
-
const attempt = value.attempt;
|
|
32
|
-
return {
|
|
33
|
-
kind: "connecting",
|
|
34
|
-
attempt: typeof attempt === "number" && attempt > 0 ? attempt : 1,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
case "connected": {
|
|
38
|
-
const remoteUserId = value.remoteUserId;
|
|
39
|
-
const remoteDeviceId = value.remoteDeviceId;
|
|
40
|
-
if (typeof remoteUserId === "string" &&
|
|
41
|
-
remoteUserId.length > 0 &&
|
|
42
|
-
typeof remoteDeviceId === "string" &&
|
|
43
|
-
remoteDeviceId.length > 0) {
|
|
44
|
-
return { kind: "connected", remoteUserId, remoteDeviceId };
|
|
45
|
-
}
|
|
46
|
-
return exports.USER_CONNECT_IDLE_STATUS;
|
|
47
|
-
}
|
|
48
|
-
case "error": {
|
|
49
|
-
const code = value.code;
|
|
50
|
-
const detail = value.detail;
|
|
51
|
-
if (code === "invalid-code" ||
|
|
52
|
-
code === "no-route" ||
|
|
53
|
-
code === "not-found-or-expired" ||
|
|
54
|
-
code === "remote-not-waiting" ||
|
|
55
|
-
code === "canceled" ||
|
|
56
|
-
code === "protocol-error") {
|
|
57
|
-
return {
|
|
58
|
-
kind: "error",
|
|
59
|
-
code,
|
|
60
|
-
detail: typeof detail === "string" ? detail : undefined,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return exports.USER_CONNECT_IDLE_STATUS;
|
|
64
|
-
}
|
|
65
|
-
default:
|
|
66
|
-
return exports.USER_CONNECT_IDLE_STATUS;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
File without changes
|
/package/dist/{user-connect/user-connect.pvars.test.d.ts → invites/group-approval.test.d.ts}
RENAMED
|
File without changes
|