@bandeira-tech/b3nd-web 0.2.1 → 0.2.2
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/apps/mod.d.ts +26 -17
- package/dist/apps/mod.js +1 -1
- package/dist/{chunk-Z3LAGZSM.js → chunk-2VOR4VLG.js} +115 -26
- package/dist/chunk-K3ZSSVHR.js +615 -0
- package/dist/{chunk-YJKJJ323.js → chunk-VAZUCGED.js} +24 -18
- package/dist/encrypt/mod.d.ts +1 -1
- package/dist/encrypt/mod.js +29 -3
- package/dist/mod-D02790g_.d.ts +241 -0
- package/dist/src/mod.web.d.ts +1 -1
- package/dist/src/mod.web.js +7 -7
- package/dist/wallet/mod.d.ts +61 -10
- package/dist/wallet/mod.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-FUMSJI3N.js +0 -327
- package/dist/mod-DHjjiF1o.d.ts +0 -111
package/dist/encrypt/mod.js
CHANGED
|
@@ -1,31 +1,57 @@
|
|
|
1
1
|
import {
|
|
2
|
+
IdentityKey,
|
|
3
|
+
PrivateEncryptionKey,
|
|
4
|
+
PublicEncryptionKey,
|
|
5
|
+
SecretEncryptionKey,
|
|
2
6
|
createAuthenticatedMessage,
|
|
7
|
+
createAuthenticatedMessageWithHex,
|
|
3
8
|
createSignedEncryptedMessage,
|
|
9
|
+
createSignedSymmetricMessage,
|
|
4
10
|
decrypt,
|
|
11
|
+
decryptSymmetric,
|
|
5
12
|
decryptWithHex,
|
|
13
|
+
deriveKeyFromSeed,
|
|
6
14
|
encrypt,
|
|
15
|
+
encryptSymmetric,
|
|
16
|
+
exportPrivateKeyPem,
|
|
7
17
|
generateEncryptionKeyPair,
|
|
8
18
|
generateNonce,
|
|
9
19
|
generateRandomData,
|
|
10
20
|
generateSigningKeyPair,
|
|
21
|
+
pemToCryptoKey,
|
|
11
22
|
sign,
|
|
23
|
+
signPayload,
|
|
12
24
|
signWithHex,
|
|
13
25
|
verify,
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
verifyAndDecryptMessage,
|
|
27
|
+
verifyPayload
|
|
28
|
+
} from "../chunk-K3ZSSVHR.js";
|
|
16
29
|
import "../chunk-MLKGABMK.js";
|
|
17
30
|
export {
|
|
31
|
+
IdentityKey,
|
|
32
|
+
PrivateEncryptionKey,
|
|
33
|
+
PublicEncryptionKey,
|
|
34
|
+
SecretEncryptionKey,
|
|
18
35
|
createAuthenticatedMessage,
|
|
36
|
+
createAuthenticatedMessageWithHex,
|
|
19
37
|
createSignedEncryptedMessage,
|
|
38
|
+
createSignedSymmetricMessage,
|
|
20
39
|
decrypt,
|
|
40
|
+
decryptSymmetric,
|
|
21
41
|
decryptWithHex,
|
|
42
|
+
deriveKeyFromSeed,
|
|
22
43
|
encrypt,
|
|
44
|
+
encryptSymmetric,
|
|
45
|
+
exportPrivateKeyPem,
|
|
23
46
|
generateEncryptionKeyPair,
|
|
24
47
|
generateNonce,
|
|
25
48
|
generateRandomData,
|
|
26
49
|
generateSigningKeyPair,
|
|
50
|
+
pemToCryptoKey,
|
|
27
51
|
sign,
|
|
52
|
+
signPayload,
|
|
28
53
|
signWithHex,
|
|
29
54
|
verify,
|
|
30
|
-
|
|
55
|
+
verifyAndDecryptMessage,
|
|
56
|
+
verifyPayload
|
|
31
57
|
};
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
interface KeyPair {
|
|
2
|
+
publicKey: CryptoKey;
|
|
3
|
+
privateKey: CryptoKey;
|
|
4
|
+
publicKeyHex: string;
|
|
5
|
+
privateKeyHex: string;
|
|
6
|
+
}
|
|
7
|
+
interface EncryptionKeyPair {
|
|
8
|
+
publicKey: CryptoKey;
|
|
9
|
+
privateKey: CryptoKey;
|
|
10
|
+
publicKeyHex: string;
|
|
11
|
+
}
|
|
12
|
+
interface EncryptedPayload {
|
|
13
|
+
data: string;
|
|
14
|
+
nonce: string;
|
|
15
|
+
ephemeralPublicKey?: string;
|
|
16
|
+
}
|
|
17
|
+
interface AuthenticatedMessage<T = unknown> {
|
|
18
|
+
auth: Array<{
|
|
19
|
+
pubkey: string;
|
|
20
|
+
signature: string;
|
|
21
|
+
}>;
|
|
22
|
+
payload: T;
|
|
23
|
+
}
|
|
24
|
+
interface SignedEncryptedMessage {
|
|
25
|
+
auth: Array<{
|
|
26
|
+
pubkey: string;
|
|
27
|
+
signature: string;
|
|
28
|
+
}>;
|
|
29
|
+
payload: EncryptedPayload;
|
|
30
|
+
}
|
|
31
|
+
interface SignedSymmetricMessage {
|
|
32
|
+
auth: Array<{
|
|
33
|
+
pubkey: string;
|
|
34
|
+
signature: string;
|
|
35
|
+
}>;
|
|
36
|
+
payload: EncryptedPayload;
|
|
37
|
+
}
|
|
38
|
+
declare class IdentityKey {
|
|
39
|
+
private readonly privateKey;
|
|
40
|
+
readonly publicKeyHex: string;
|
|
41
|
+
private constructor();
|
|
42
|
+
static generate(): Promise<{
|
|
43
|
+
key: IdentityKey;
|
|
44
|
+
privateKeyPem: string;
|
|
45
|
+
publicKeyHex: string;
|
|
46
|
+
}>;
|
|
47
|
+
static fromPem(pem: string, publicKeyHex: string): Promise<IdentityKey>;
|
|
48
|
+
static fromHex(params: {
|
|
49
|
+
privateKeyHex: string;
|
|
50
|
+
publicKeyHex: string;
|
|
51
|
+
}): Promise<IdentityKey>;
|
|
52
|
+
sign(payload: unknown): Promise<string>;
|
|
53
|
+
}
|
|
54
|
+
declare class PublicEncryptionKey {
|
|
55
|
+
readonly publicKeyHex: string;
|
|
56
|
+
readonly publicKey: CryptoKey | null;
|
|
57
|
+
constructor(publicKeyHex: string, publicKey: CryptoKey | null);
|
|
58
|
+
static fromHex(publicKeyHex: string): Promise<PublicEncryptionKey>;
|
|
59
|
+
static generatePair(): Promise<{
|
|
60
|
+
publicKey: PublicEncryptionKey;
|
|
61
|
+
privateKeyHex: string;
|
|
62
|
+
}>;
|
|
63
|
+
encrypt(data: unknown): Promise<EncryptedPayload>;
|
|
64
|
+
toHex(): string;
|
|
65
|
+
}
|
|
66
|
+
declare class SecretEncryptionKey {
|
|
67
|
+
readonly keyHex: string;
|
|
68
|
+
private constructor();
|
|
69
|
+
static fromSecret(params: {
|
|
70
|
+
secret: string;
|
|
71
|
+
salt: string;
|
|
72
|
+
iterations?: number;
|
|
73
|
+
}): Promise<SecretEncryptionKey>;
|
|
74
|
+
static fromHex(keyHex: string): SecretEncryptionKey;
|
|
75
|
+
encrypt(data: unknown): Promise<EncryptedPayload>;
|
|
76
|
+
decrypt(payload: EncryptedPayload): Promise<unknown>;
|
|
77
|
+
}
|
|
78
|
+
declare class PrivateEncryptionKey {
|
|
79
|
+
readonly privateKey: CryptoKey;
|
|
80
|
+
readonly privateKeyHex: string;
|
|
81
|
+
readonly publicKeyHex: string;
|
|
82
|
+
constructor(privateKey: CryptoKey, privateKeyHex: string, publicKeyHex: string);
|
|
83
|
+
static fromHex(params: {
|
|
84
|
+
privateKeyHex: string;
|
|
85
|
+
publicKeyHex: string;
|
|
86
|
+
}): Promise<PrivateEncryptionKey>;
|
|
87
|
+
static generatePair(): Promise<{
|
|
88
|
+
privateKey: PrivateEncryptionKey;
|
|
89
|
+
publicKey: PublicEncryptionKey;
|
|
90
|
+
}>;
|
|
91
|
+
toPublic(): PublicEncryptionKey;
|
|
92
|
+
decrypt(payload: EncryptedPayload): Promise<unknown>;
|
|
93
|
+
toHex(): string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Convert a PEM-encoded private key to a CryptoKey
|
|
97
|
+
*/
|
|
98
|
+
declare function pemToCryptoKey(pem: string, algorithm: "Ed25519" | "X25519"): Promise<CryptoKey>;
|
|
99
|
+
/**
|
|
100
|
+
* Generate an Ed25519 keypair for signing
|
|
101
|
+
*/
|
|
102
|
+
declare function generateSigningKeyPair(): Promise<KeyPair>;
|
|
103
|
+
/**
|
|
104
|
+
* Generate an X25519 keypair for encryption (ECDH)
|
|
105
|
+
*/
|
|
106
|
+
declare function generateEncryptionKeyPair(): Promise<EncryptionKeyPair>;
|
|
107
|
+
/**
|
|
108
|
+
* Sign a payload with an Ed25519 private key
|
|
109
|
+
*/
|
|
110
|
+
declare function sign<T>(privateKey: CryptoKey, payload: T): Promise<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Sign a payload with an Ed25519 private key from hex
|
|
113
|
+
*/
|
|
114
|
+
declare function signWithHex<T>(privateKeyHex: string, payload: T): Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Verify a signature using Ed25519 public key
|
|
117
|
+
*/
|
|
118
|
+
declare function verify<T>(publicKeyHex: string, signatureHex: string, payload: T): Promise<boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* Encrypt data using X25519 ECDH + AES-GCM
|
|
121
|
+
* Uses ephemeral keypair for forward secrecy
|
|
122
|
+
*/
|
|
123
|
+
declare function encrypt(data: unknown, recipientPublicKeyHex: string): Promise<EncryptedPayload>;
|
|
124
|
+
/**
|
|
125
|
+
* Decrypt data using X25519 ECDH + AES-GCM
|
|
126
|
+
*/
|
|
127
|
+
declare function decrypt(encryptedPayload: EncryptedPayload, recipientPrivateKey: CryptoKey): Promise<unknown>;
|
|
128
|
+
/**
|
|
129
|
+
* Decrypt data using private key from hex
|
|
130
|
+
*/
|
|
131
|
+
declare function decryptWithHex(encryptedPayload: EncryptedPayload, recipientPrivateKeyHex: string): Promise<unknown>;
|
|
132
|
+
/**
|
|
133
|
+
* Create an authenticated message (signed but not encrypted)
|
|
134
|
+
*/
|
|
135
|
+
declare function createAuthenticatedMessage<T>(payload: T, signers: Array<{
|
|
136
|
+
privateKey: CryptoKey;
|
|
137
|
+
publicKeyHex: string;
|
|
138
|
+
}>): Promise<AuthenticatedMessage<T>>;
|
|
139
|
+
/**
|
|
140
|
+
* Create an authenticated message with hex-encoded keys (convenience wrapper)
|
|
141
|
+
*/
|
|
142
|
+
declare function createAuthenticatedMessageWithHex<T>(payload: T, pubkeyHex: string, privateKeyHex: string): Promise<AuthenticatedMessage<T>>;
|
|
143
|
+
/**
|
|
144
|
+
* Derive an encryption key from seed and salt using PBKDF2
|
|
145
|
+
* Returns hex-encoded key suitable for encrypt/decrypt functions
|
|
146
|
+
*/
|
|
147
|
+
declare function deriveKeyFromSeed(seed: string, salt: string, iterations?: number): Promise<string>;
|
|
148
|
+
declare function generateNonce(length?: number): Uint8Array;
|
|
149
|
+
declare function generateRandomData(size: number): Uint8Array;
|
|
150
|
+
declare function exportPrivateKeyPem(privateKey: CryptoKey, label: string): Promise<string>;
|
|
151
|
+
declare function signPayload(params: {
|
|
152
|
+
payload: unknown;
|
|
153
|
+
identity: IdentityKey;
|
|
154
|
+
}): Promise<Array<{
|
|
155
|
+
pubkey: string;
|
|
156
|
+
signature: string;
|
|
157
|
+
}>>;
|
|
158
|
+
declare function verifyPayload(params: {
|
|
159
|
+
payload: unknown;
|
|
160
|
+
auth: Array<{
|
|
161
|
+
pubkey: string;
|
|
162
|
+
signature: string;
|
|
163
|
+
}>;
|
|
164
|
+
}): Promise<{
|
|
165
|
+
verified: boolean;
|
|
166
|
+
signers: string[];
|
|
167
|
+
}>;
|
|
168
|
+
declare function createSignedEncryptedMessage(params: {
|
|
169
|
+
data: unknown;
|
|
170
|
+
identity: IdentityKey;
|
|
171
|
+
encryptionKey: SecretEncryptionKey | PublicEncryptionKey;
|
|
172
|
+
}): Promise<SignedEncryptedMessage>;
|
|
173
|
+
declare function createSignedEncryptedMessage(data: unknown, signers: Array<{
|
|
174
|
+
privateKey: CryptoKey;
|
|
175
|
+
publicKeyHex: string;
|
|
176
|
+
}>, recipientPublicKeyHex: string): Promise<SignedEncryptedMessage>;
|
|
177
|
+
declare function verifyAndDecryptMessage(params: {
|
|
178
|
+
message: SignedEncryptedMessage;
|
|
179
|
+
encryptionKey: SecretEncryptionKey | PrivateEncryptionKey;
|
|
180
|
+
}): Promise<{
|
|
181
|
+
data: unknown;
|
|
182
|
+
verified: boolean;
|
|
183
|
+
signers: string[];
|
|
184
|
+
}>;
|
|
185
|
+
/**
|
|
186
|
+
* Encrypt data using a symmetric key (AES-GCM) provided as hex
|
|
187
|
+
*/
|
|
188
|
+
declare function encryptSymmetric(data: unknown, keyHex: string): Promise<EncryptedPayload>;
|
|
189
|
+
/**
|
|
190
|
+
* Decrypt data using a symmetric key (AES-GCM) provided as hex
|
|
191
|
+
*/
|
|
192
|
+
declare function decryptSymmetric(payload: EncryptedPayload, keyHex: string): Promise<unknown>;
|
|
193
|
+
/**
|
|
194
|
+
* Create a signed symmetric message (signs encrypted payload)
|
|
195
|
+
*/
|
|
196
|
+
declare function createSignedSymmetricMessage(data: unknown, signers: Array<{
|
|
197
|
+
privateKey: CryptoKey;
|
|
198
|
+
publicKeyHex: string;
|
|
199
|
+
}>, keyHex: string): Promise<SignedSymmetricMessage>;
|
|
200
|
+
|
|
201
|
+
type mod_AuthenticatedMessage<T = unknown> = AuthenticatedMessage<T>;
|
|
202
|
+
type mod_EncryptedPayload = EncryptedPayload;
|
|
203
|
+
type mod_EncryptionKeyPair = EncryptionKeyPair;
|
|
204
|
+
type mod_IdentityKey = IdentityKey;
|
|
205
|
+
declare const mod_IdentityKey: typeof IdentityKey;
|
|
206
|
+
type mod_KeyPair = KeyPair;
|
|
207
|
+
type mod_PrivateEncryptionKey = PrivateEncryptionKey;
|
|
208
|
+
declare const mod_PrivateEncryptionKey: typeof PrivateEncryptionKey;
|
|
209
|
+
type mod_PublicEncryptionKey = PublicEncryptionKey;
|
|
210
|
+
declare const mod_PublicEncryptionKey: typeof PublicEncryptionKey;
|
|
211
|
+
type mod_SecretEncryptionKey = SecretEncryptionKey;
|
|
212
|
+
declare const mod_SecretEncryptionKey: typeof SecretEncryptionKey;
|
|
213
|
+
type mod_SignedEncryptedMessage = SignedEncryptedMessage;
|
|
214
|
+
type mod_SignedSymmetricMessage = SignedSymmetricMessage;
|
|
215
|
+
declare const mod_createAuthenticatedMessage: typeof createAuthenticatedMessage;
|
|
216
|
+
declare const mod_createAuthenticatedMessageWithHex: typeof createAuthenticatedMessageWithHex;
|
|
217
|
+
declare const mod_createSignedEncryptedMessage: typeof createSignedEncryptedMessage;
|
|
218
|
+
declare const mod_createSignedSymmetricMessage: typeof createSignedSymmetricMessage;
|
|
219
|
+
declare const mod_decrypt: typeof decrypt;
|
|
220
|
+
declare const mod_decryptSymmetric: typeof decryptSymmetric;
|
|
221
|
+
declare const mod_decryptWithHex: typeof decryptWithHex;
|
|
222
|
+
declare const mod_deriveKeyFromSeed: typeof deriveKeyFromSeed;
|
|
223
|
+
declare const mod_encrypt: typeof encrypt;
|
|
224
|
+
declare const mod_encryptSymmetric: typeof encryptSymmetric;
|
|
225
|
+
declare const mod_exportPrivateKeyPem: typeof exportPrivateKeyPem;
|
|
226
|
+
declare const mod_generateEncryptionKeyPair: typeof generateEncryptionKeyPair;
|
|
227
|
+
declare const mod_generateNonce: typeof generateNonce;
|
|
228
|
+
declare const mod_generateRandomData: typeof generateRandomData;
|
|
229
|
+
declare const mod_generateSigningKeyPair: typeof generateSigningKeyPair;
|
|
230
|
+
declare const mod_pemToCryptoKey: typeof pemToCryptoKey;
|
|
231
|
+
declare const mod_sign: typeof sign;
|
|
232
|
+
declare const mod_signPayload: typeof signPayload;
|
|
233
|
+
declare const mod_signWithHex: typeof signWithHex;
|
|
234
|
+
declare const mod_verify: typeof verify;
|
|
235
|
+
declare const mod_verifyAndDecryptMessage: typeof verifyAndDecryptMessage;
|
|
236
|
+
declare const mod_verifyPayload: typeof verifyPayload;
|
|
237
|
+
declare namespace mod {
|
|
238
|
+
export { type mod_AuthenticatedMessage as AuthenticatedMessage, type mod_EncryptedPayload as EncryptedPayload, type mod_EncryptionKeyPair as EncryptionKeyPair, mod_IdentityKey as IdentityKey, type mod_KeyPair as KeyPair, mod_PrivateEncryptionKey as PrivateEncryptionKey, mod_PublicEncryptionKey as PublicEncryptionKey, mod_SecretEncryptionKey as SecretEncryptionKey, type mod_SignedEncryptedMessage as SignedEncryptedMessage, type mod_SignedSymmetricMessage as SignedSymmetricMessage, mod_createAuthenticatedMessage as createAuthenticatedMessage, mod_createAuthenticatedMessageWithHex as createAuthenticatedMessageWithHex, mod_createSignedEncryptedMessage as createSignedEncryptedMessage, mod_createSignedSymmetricMessage as createSignedSymmetricMessage, mod_decrypt as decrypt, mod_decryptSymmetric as decryptSymmetric, mod_decryptWithHex as decryptWithHex, mod_deriveKeyFromSeed as deriveKeyFromSeed, mod_encrypt as encrypt, mod_encryptSymmetric as encryptSymmetric, mod_exportPrivateKeyPem as exportPrivateKeyPem, mod_generateEncryptionKeyPair as generateEncryptionKeyPair, mod_generateNonce as generateNonce, mod_generateRandomData as generateRandomData, mod_generateSigningKeyPair as generateSigningKeyPair, mod_pemToCryptoKey as pemToCryptoKey, mod_sign as sign, mod_signPayload as signPayload, mod_signWithHex as signWithHex, mod_verify as verify, mod_verifyAndDecryptMessage as verifyAndDecryptMessage, mod_verifyPayload as verifyPayload };
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export { type AuthenticatedMessage as A, createSignedSymmetricMessage as B, type EncryptionKeyPair as E, IdentityKey as I, type KeyPair as K, PublicEncryptionKey as P, type SignedEncryptedMessage as S, type EncryptedPayload as a, type SignedSymmetricMessage as b, SecretEncryptionKey as c, PrivateEncryptionKey as d, generateEncryptionKeyPair as e, signWithHex as f, generateSigningKeyPair as g, encrypt as h, decrypt as i, decryptWithHex as j, createAuthenticatedMessage as k, createAuthenticatedMessageWithHex as l, mod as m, deriveKeyFromSeed as n, generateNonce as o, pemToCryptoKey as p, generateRandomData as q, exportPrivateKeyPem as r, sign as s, signPayload as t, verifyPayload as u, verify as v, createSignedEncryptedMessage as w, verifyAndDecryptMessage as x, encryptSymmetric as y, decryptSymmetric as z };
|
package/dist/src/mod.web.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export { WebSocketClient } from '../clients/websocket/mod.js';
|
|
|
4
4
|
export { LocalStorageClient } from '../clients/local-storage/mod.js';
|
|
5
5
|
export { WalletClient } from '../wallet/mod.js';
|
|
6
6
|
export { AppsClient } from '../apps/mod.js';
|
|
7
|
-
export { m as encrypt } from '../mod-
|
|
7
|
+
export { m as encrypt } from '../mod-D02790g_.js';
|
package/dist/src/mod.web.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AppsClient
|
|
3
|
+
} from "../chunk-VAZUCGED.js";
|
|
1
4
|
import {
|
|
2
5
|
mod_exports
|
|
3
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-K3ZSSVHR.js";
|
|
7
|
+
import {
|
|
8
|
+
WalletClient
|
|
9
|
+
} from "../chunk-2VOR4VLG.js";
|
|
4
10
|
import {
|
|
5
11
|
HttpClient
|
|
6
12
|
} from "../chunk-LFUC4ETD.js";
|
|
@@ -10,12 +16,6 @@ import {
|
|
|
10
16
|
import {
|
|
11
17
|
WebSocketClient
|
|
12
18
|
} from "../chunk-T43IWAQK.js";
|
|
13
|
-
import {
|
|
14
|
-
AppsClient
|
|
15
|
-
} from "../chunk-YJKJJ323.js";
|
|
16
|
-
import {
|
|
17
|
-
WalletClient
|
|
18
|
-
} from "../chunk-Z3LAGZSM.js";
|
|
19
19
|
import "../chunk-MLKGABMK.js";
|
|
20
20
|
export {
|
|
21
21
|
AppsClient,
|
package/dist/wallet/mod.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ interface ProxyWriteResponse {
|
|
|
73
73
|
/**
|
|
74
74
|
* API response wrapper
|
|
75
75
|
*/
|
|
76
|
-
interface ApiResponse
|
|
76
|
+
interface ApiResponse {
|
|
77
77
|
success: boolean;
|
|
78
78
|
error?: string;
|
|
79
79
|
[key: string]: unknown;
|
|
@@ -132,6 +132,36 @@ interface HealthResponse extends ApiResponse {
|
|
|
132
132
|
server: string;
|
|
133
133
|
timestamp: string;
|
|
134
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Google OAuth session (extended AuthSession with Google profile info)
|
|
137
|
+
*/
|
|
138
|
+
interface GoogleAuthSession extends AuthSession {
|
|
139
|
+
email: string;
|
|
140
|
+
name?: string;
|
|
141
|
+
picture?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Google signup response
|
|
145
|
+
*/
|
|
146
|
+
interface GoogleSignupResponse extends ApiResponse {
|
|
147
|
+
username: string;
|
|
148
|
+
email: string;
|
|
149
|
+
name?: string;
|
|
150
|
+
picture?: string;
|
|
151
|
+
token: string;
|
|
152
|
+
expiresIn: number;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Google login response
|
|
156
|
+
*/
|
|
157
|
+
interface GoogleLoginResponse extends ApiResponse {
|
|
158
|
+
username: string;
|
|
159
|
+
email: string;
|
|
160
|
+
name?: string;
|
|
161
|
+
picture?: string;
|
|
162
|
+
token: string;
|
|
163
|
+
expiresIn: number;
|
|
164
|
+
}
|
|
135
165
|
|
|
136
166
|
/**
|
|
137
167
|
* B3nd Wallet Client
|
|
@@ -178,6 +208,8 @@ declare class WalletClient {
|
|
|
178
208
|
private fetchImpl;
|
|
179
209
|
private currentSession;
|
|
180
210
|
constructor(config: WalletClientConfig);
|
|
211
|
+
private buildUrl;
|
|
212
|
+
private buildAppKeyUrl;
|
|
181
213
|
/**
|
|
182
214
|
* Get the current authenticated session
|
|
183
215
|
*/
|
|
@@ -220,7 +252,7 @@ declare class WalletClient {
|
|
|
220
252
|
* Change password for current user
|
|
221
253
|
* Requires active authentication session
|
|
222
254
|
*/
|
|
223
|
-
changePassword(oldPassword: string, newPassword: string): Promise<void>;
|
|
255
|
+
changePassword(appKey: string, oldPassword: string, newPassword: string): Promise<void>;
|
|
224
256
|
/**
|
|
225
257
|
* Request a password reset token
|
|
226
258
|
* Does not require authentication
|
|
@@ -234,24 +266,24 @@ declare class WalletClient {
|
|
|
234
266
|
/**
|
|
235
267
|
* Sign up with app token (scoped to an app)
|
|
236
268
|
*/
|
|
237
|
-
signupWithToken(
|
|
269
|
+
signupWithToken(appKey: string, tokenOrCredentials: string | UserCredentials, maybeCredentials?: UserCredentials): Promise<AuthSession>;
|
|
238
270
|
/**
|
|
239
271
|
* Login with app token and session (scoped to an app)
|
|
240
272
|
*/
|
|
241
|
-
loginWithTokenSession(
|
|
273
|
+
loginWithTokenSession(appKey: string, tokenOrSession: string, sessionOrCredentials: string | UserCredentials, maybeCredentials?: UserCredentials): Promise<AuthSession>;
|
|
242
274
|
/**
|
|
243
275
|
* Request password reset scoped to app token
|
|
244
276
|
*/
|
|
245
|
-
requestPasswordResetWithToken(
|
|
277
|
+
requestPasswordResetWithToken(appKey: string, tokenOrUsername: string, maybeUsername?: string): Promise<PasswordResetToken>;
|
|
246
278
|
/**
|
|
247
|
-
* Reset password scoped to app
|
|
279
|
+
* Reset password scoped to an app
|
|
248
280
|
*/
|
|
249
|
-
resetPasswordWithToken(
|
|
281
|
+
resetPasswordWithToken(appKey: string, _tokenOrUsername: string, usernameOrReset: string, resetToken?: string, newPassword?: string): Promise<AuthSession>;
|
|
250
282
|
/**
|
|
251
283
|
* Get public keys for the current authenticated user.
|
|
252
284
|
* Requires an active authentication session.
|
|
253
285
|
*/
|
|
254
|
-
getPublicKeys(): Promise<UserPublicKeys>;
|
|
286
|
+
getPublicKeys(appKey: string): Promise<UserPublicKeys>;
|
|
255
287
|
/**
|
|
256
288
|
* Proxy a write request through the wallet server
|
|
257
289
|
* The server signs the write with its identity key
|
|
@@ -262,7 +294,7 @@ declare class WalletClient {
|
|
|
262
294
|
* Convenience method: Get current user's public keys
|
|
263
295
|
* Requires active authentication session
|
|
264
296
|
*/
|
|
265
|
-
getMyPublicKeys(): Promise<UserPublicKeys>;
|
|
297
|
+
getMyPublicKeys(appKey: string): Promise<UserPublicKeys>;
|
|
266
298
|
/**
|
|
267
299
|
* Get server's public keys
|
|
268
300
|
*
|
|
@@ -273,6 +305,25 @@ declare class WalletClient {
|
|
|
273
305
|
identityPublicKeyHex: string;
|
|
274
306
|
encryptionPublicKeyHex: string;
|
|
275
307
|
}>;
|
|
308
|
+
/**
|
|
309
|
+
* Sign up with Google OAuth (scoped to app token)
|
|
310
|
+
* Returns session data with Google profile info - call setSession() to activate it
|
|
311
|
+
*
|
|
312
|
+
* @param token - App token from app server
|
|
313
|
+
* @param googleIdToken - Google ID token from Google Sign-In
|
|
314
|
+
* @returns GoogleAuthSession with username, JWT token, and Google profile info
|
|
315
|
+
*/
|
|
316
|
+
signupWithGoogle(appKey: string, token: string, googleIdToken: string): Promise<GoogleAuthSession>;
|
|
317
|
+
/**
|
|
318
|
+
* Login with Google OAuth (scoped to app token and session)
|
|
319
|
+
* Returns session data with Google profile info - call setSession() to activate it
|
|
320
|
+
*
|
|
321
|
+
* @param token - App token from app server
|
|
322
|
+
* @param session - Session key from app server
|
|
323
|
+
* @param googleIdToken - Google ID token from Google Sign-In
|
|
324
|
+
* @returns GoogleAuthSession with username, JWT token, and Google profile info
|
|
325
|
+
*/
|
|
326
|
+
loginWithGoogle(appKey: string, token: string, session: string, googleIdToken: string): Promise<GoogleAuthSession>;
|
|
276
327
|
}
|
|
277
328
|
|
|
278
|
-
export { type ApiResponse, type AuthSession, type ChangePasswordResponse, type HealthResponse, type LoginResponse, type PasswordResetToken, type ProxyWriteRequest, type ProxyWriteResponse, type PublicKeysResponse, type RequestPasswordResetResponse, type ResetPasswordResponse, type SignupResponse, type UserCredentials, type UserPublicKeys, WalletClient, type WalletClientConfig };
|
|
329
|
+
export { type ApiResponse, type AuthSession, type ChangePasswordResponse, type GoogleAuthSession, type GoogleLoginResponse, type GoogleSignupResponse, type HealthResponse, type LoginResponse, type PasswordResetToken, type ProxyWriteRequest, type ProxyWriteResponse, type PublicKeysResponse, type RequestPasswordResetResponse, type ResetPasswordResponse, type SignupResponse, type UserCredentials, type UserPublicKeys, WalletClient, type WalletClientConfig };
|
package/dist/wallet/mod.js
CHANGED