@pelican-identity/auth-core 1.2.9 → 1.2.10
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/README.md +0 -13
- package/dist/index.d.ts +187 -8
- package/dist/index.js +515 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/constants.d.ts +0 -2
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -2
- package/dist/constants.js.map +0 -1
- package/dist/engine/engine.d.ts +0 -31
- package/dist/engine/engine.d.ts.map +0 -1
- package/dist/engine/engine.js +0 -238
- package/dist/engine/engine.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -102
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -2
- package/dist/types/types.js.map +0 -1
- package/dist/utilities/crypto.d.ts +0 -18
- package/dist/utilities/crypto.d.ts.map +0 -1
- package/dist/utilities/crypto.js +0 -37
- package/dist/utilities/crypto.js.map +0 -1
- package/dist/utilities/stateMachine.d.ts +0 -9
- package/dist/utilities/stateMachine.d.ts.map +0 -1
- package/dist/utilities/stateMachine.js +0 -18
- package/dist/utilities/stateMachine.js.map +0 -1
- package/dist/utilities/storage.d.ts +0 -26
- package/dist/utilities/storage.d.ts.map +0 -1
- package/dist/utilities/storage.js +0 -92
- package/dist/utilities/storage.js.map +0 -1
- package/dist/utilities/transport.d.ts +0 -22
- package/dist/utilities/transport.d.ts.map +0 -1
- package/dist/utilities/transport.js +0 -57
- package/dist/utilities/transport.js.map +0 -1
package/dist/engine/engine.js
DELETED
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import CryptoService from "../utilities/crypto";
|
|
2
|
-
import QRCode from "qrcode";
|
|
3
|
-
import { storeAuthSession, getAuthSession, clearAuthSession, } from "../utilities/storage";
|
|
4
|
-
import { StateMachine } from "../utilities/stateMachine";
|
|
5
|
-
import { Transport } from "../utilities/transport";
|
|
6
|
-
import { BASEURL } from "../constants";
|
|
7
|
-
export class PelicanAuthentication {
|
|
8
|
-
constructor(config) {
|
|
9
|
-
this.crypto = new CryptoService();
|
|
10
|
-
this.stateMachine = new StateMachine();
|
|
11
|
-
this.sessionId = "";
|
|
12
|
-
this.sessionKey = null;
|
|
13
|
-
this.listeners = {};
|
|
14
|
-
if (!config.publicKey)
|
|
15
|
-
throw new Error("Missing publicKey");
|
|
16
|
-
if (!config.projectId)
|
|
17
|
-
throw new Error("Missing projectId");
|
|
18
|
-
if (!config.authType)
|
|
19
|
-
throw new Error("Missing authType");
|
|
20
|
-
this.config = {
|
|
21
|
-
continuousMode: false,
|
|
22
|
-
forceQRCode: false,
|
|
23
|
-
...config,
|
|
24
|
-
};
|
|
25
|
-
this.stateMachine.subscribe((s) => this.emit("state", s));
|
|
26
|
-
this.attachVisibilityRecovery();
|
|
27
|
-
}
|
|
28
|
-
on(event, cb) {
|
|
29
|
-
var _a;
|
|
30
|
-
(_a = this.listeners)[event] ?? (_a[event] = new Set());
|
|
31
|
-
this.listeners[event].add(cb);
|
|
32
|
-
return () => this.listeners[event].delete(cb);
|
|
33
|
-
}
|
|
34
|
-
async start() {
|
|
35
|
-
if (this.stateMachine.current !== "idle")
|
|
36
|
-
return;
|
|
37
|
-
this.resetSession();
|
|
38
|
-
clearAuthSession();
|
|
39
|
-
this.stateMachine.transition("initializing");
|
|
40
|
-
try {
|
|
41
|
-
const relay = await this.fetchRelayUrl();
|
|
42
|
-
this.sessionKey = this.crypto.generateSymmetricKey();
|
|
43
|
-
this.sessionId = crypto.randomUUID() + crypto.randomUUID();
|
|
44
|
-
this.transport = new Transport({
|
|
45
|
-
onOpen: () => {
|
|
46
|
-
this.transport.send({
|
|
47
|
-
type: "register",
|
|
48
|
-
sessionID: this.sessionId,
|
|
49
|
-
...this.config,
|
|
50
|
-
});
|
|
51
|
-
this.stateMachine.transition("awaiting-pair");
|
|
52
|
-
},
|
|
53
|
-
onMessage: (msg) => this.handleMessage(msg),
|
|
54
|
-
onError: () => this.fail(new Error("WebSocket connection failed")),
|
|
55
|
-
});
|
|
56
|
-
this.transport.connect(relay);
|
|
57
|
-
await this.emitEntryPoint();
|
|
58
|
-
}
|
|
59
|
-
catch (err) {
|
|
60
|
-
this.fail(err instanceof Error ? err : new Error("Start failed"));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
stop() {
|
|
64
|
-
this.terminate(false);
|
|
65
|
-
}
|
|
66
|
-
async fetchRelayUrl() {
|
|
67
|
-
const { publicKey, projectId, authType } = this.config;
|
|
68
|
-
const res = await fetch(`${BASEURL}/relay?public_key=${publicKey}&auth_type=${authType}&project_id=${projectId}`);
|
|
69
|
-
if (!res.ok) {
|
|
70
|
-
const error = await res.text();
|
|
71
|
-
throw new Error(error);
|
|
72
|
-
}
|
|
73
|
-
const json = await res.json();
|
|
74
|
-
return json.relay_url;
|
|
75
|
-
}
|
|
76
|
-
async emitEntryPoint() {
|
|
77
|
-
const payload = {
|
|
78
|
-
sessionID: this.sessionId,
|
|
79
|
-
sessionKey: this.sessionKey,
|
|
80
|
-
publicKey: this.config.publicKey,
|
|
81
|
-
authType: this.config.authType,
|
|
82
|
-
projectId: this.config.projectId,
|
|
83
|
-
url: window.location.href,
|
|
84
|
-
};
|
|
85
|
-
const shouldUseQR = this.config.forceQRCode ||
|
|
86
|
-
!/Android|iPhone|iPad/i.test(navigator.userAgent);
|
|
87
|
-
if (!shouldUseQR && this.sessionKey) {
|
|
88
|
-
storeAuthSession(this.sessionId, this.sessionKey, 5 * 60000);
|
|
89
|
-
this.emit("deeplink", `pelicanvault://auth/deep-link?sessionID=${encodeURIComponent(this.sessionId)}&sessionKey=${encodeURIComponent(this.sessionKey)}&publicKey=${encodeURIComponent(this.config.publicKey)}&authType=${this.config.authType}&projectId=${encodeURIComponent(this.config.projectId)}&url=${encodeURIComponent(window.location.href)}`);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
const qr = await QRCode.toDataURL(JSON.stringify(payload), {
|
|
93
|
-
type: "image/png",
|
|
94
|
-
scale: 3,
|
|
95
|
-
color: { light: "#ffffff", dark: "#424242ff" },
|
|
96
|
-
});
|
|
97
|
-
this.emit("qr", qr);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
handleMessage(msg) {
|
|
101
|
-
switch (msg.type) {
|
|
102
|
-
case "paired":
|
|
103
|
-
this.stateMachine.transition("paired");
|
|
104
|
-
this.transport.send({
|
|
105
|
-
type: "authenticate",
|
|
106
|
-
sessionID: this.sessionId,
|
|
107
|
-
...this.config,
|
|
108
|
-
url: window.location.href,
|
|
109
|
-
});
|
|
110
|
-
return;
|
|
111
|
-
case "phone-auth-success":
|
|
112
|
-
this.handleAuthSuccess(msg);
|
|
113
|
-
return;
|
|
114
|
-
case "phone-terminated":
|
|
115
|
-
this.fail(new Error("Authenticating device terminated the connection"));
|
|
116
|
-
this.restartIfContinuous();
|
|
117
|
-
return;
|
|
118
|
-
case "confirmed":
|
|
119
|
-
this.terminate(true);
|
|
120
|
-
this.restartIfContinuous();
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
handleAuthSuccess(msg) {
|
|
125
|
-
if (!this.sessionKey || !msg.cipher || !msg.nonce) {
|
|
126
|
-
this.fail(new Error("Invalid authentication payload"));
|
|
127
|
-
this.restartIfContinuous();
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
try {
|
|
131
|
-
const decrypted = this.crypto.decryptSymmetric({
|
|
132
|
-
encrypted: { cipher: msg.cipher, nonce: msg.nonce },
|
|
133
|
-
keyString: this.sessionKey,
|
|
134
|
-
});
|
|
135
|
-
if (!decrypted) {
|
|
136
|
-
this.fail(new Error("Invalid authentication data"));
|
|
137
|
-
this.restartIfContinuous();
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
const result = JSON.parse(decrypted);
|
|
141
|
-
this.emit("success", result);
|
|
142
|
-
this.stateMachine.transition("authenticated");
|
|
143
|
-
this.transport?.send({
|
|
144
|
-
type: "confirm",
|
|
145
|
-
sessionID: this.sessionId,
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
this.fail(new Error("Failed to decrypt authentication data"));
|
|
150
|
-
this.restartIfContinuous();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
async getCachedEntry(cached) {
|
|
154
|
-
try {
|
|
155
|
-
const res = await fetch(`${BASEURL}/session?session_id=${cached.sessionId}`);
|
|
156
|
-
if (!res.ok)
|
|
157
|
-
throw new Error("Invalid session");
|
|
158
|
-
const data = await res.json();
|
|
159
|
-
const decrypted = this.crypto.decryptSymmetric({
|
|
160
|
-
encrypted: { cipher: data.cipher, nonce: data.nonce },
|
|
161
|
-
keyString: cached.sessionKey,
|
|
162
|
-
});
|
|
163
|
-
if (!decrypted) {
|
|
164
|
-
this.fail(new Error("Invalid session data"));
|
|
165
|
-
this.restartIfContinuous();
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const result = JSON.parse(decrypted);
|
|
169
|
-
this.emit("success", result);
|
|
170
|
-
clearAuthSession();
|
|
171
|
-
}
|
|
172
|
-
catch {
|
|
173
|
-
this.fail(new Error("Session recovery failed"));
|
|
174
|
-
this.restartIfContinuous();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
attachVisibilityRecovery() {
|
|
178
|
-
this.visibilityHandler = async () => {
|
|
179
|
-
if (document.visibilityState !== "visible")
|
|
180
|
-
return;
|
|
181
|
-
const cached = getAuthSession();
|
|
182
|
-
if (!cached)
|
|
183
|
-
return;
|
|
184
|
-
await this.getCachedEntry(cached);
|
|
185
|
-
};
|
|
186
|
-
document.addEventListener("visibilitychange", this.visibilityHandler);
|
|
187
|
-
}
|
|
188
|
-
detachVisibilityRecovery() {
|
|
189
|
-
if (this.visibilityHandler) {
|
|
190
|
-
document.removeEventListener("visibilitychange", this.visibilityHandler);
|
|
191
|
-
this.visibilityHandler = undefined;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
terminate(success) {
|
|
195
|
-
if (!success) {
|
|
196
|
-
this.transport?.send({
|
|
197
|
-
type: "client-terminated",
|
|
198
|
-
sessionID: this.sessionId,
|
|
199
|
-
projectId: this.config.projectId,
|
|
200
|
-
publicKey: this.config.publicKey,
|
|
201
|
-
authType: this.config.authType,
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
this.transport?.close();
|
|
205
|
-
clearAuthSession();
|
|
206
|
-
this.resetSession();
|
|
207
|
-
if (!this.config.continuousMode) {
|
|
208
|
-
this.detachVisibilityRecovery();
|
|
209
|
-
}
|
|
210
|
-
this.stateMachine.transition(success ? "confirmed" : "idle");
|
|
211
|
-
}
|
|
212
|
-
restartIfContinuous() {
|
|
213
|
-
this.stateMachine.transition("idle");
|
|
214
|
-
this.transport?.close();
|
|
215
|
-
if (!this.config.continuousMode)
|
|
216
|
-
return;
|
|
217
|
-
setTimeout(() => {
|
|
218
|
-
this.start();
|
|
219
|
-
}, 150);
|
|
220
|
-
}
|
|
221
|
-
resetSession() {
|
|
222
|
-
this.sessionId = "";
|
|
223
|
-
this.sessionKey = null;
|
|
224
|
-
}
|
|
225
|
-
destroy() {
|
|
226
|
-
this.detachVisibilityRecovery();
|
|
227
|
-
this.transport?.close();
|
|
228
|
-
this.listeners = {};
|
|
229
|
-
}
|
|
230
|
-
emit(event, payload) {
|
|
231
|
-
this.listeners[event]?.forEach((cb) => cb(payload));
|
|
232
|
-
}
|
|
233
|
-
fail(err) {
|
|
234
|
-
this.emit("error", err);
|
|
235
|
-
this.stateMachine.transition("error");
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
//# sourceMappingURL=engine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/engine/engine.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,MAAM,MAAM,QAAQ,CAAC;AAO5B,OAAO,EACL,gBAAgB,EAChB,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AAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/types/types.d.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
export type AuthType = "login" | "signup" | "id-verification";
|
|
2
|
-
export type PelicanAuthState = "idle" | "initializing" | "awaiting-pair" | "paired" | "awaiting-auth" | "authenticated" | "confirmed" | "error" | "terminated";
|
|
3
|
-
export interface PelicanAuthConfig {
|
|
4
|
-
publicKey: string;
|
|
5
|
-
projectId: string;
|
|
6
|
-
authType: AuthType;
|
|
7
|
-
continuousMode?: boolean;
|
|
8
|
-
forceQRCode?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export type PelicanAuthEventMap = {
|
|
11
|
-
state: PelicanAuthState;
|
|
12
|
-
qr: string;
|
|
13
|
-
deeplink: string;
|
|
14
|
-
success: IdentityResult;
|
|
15
|
-
error: Error;
|
|
16
|
-
};
|
|
17
|
-
export interface ISocketMessage {
|
|
18
|
-
type: "confirmed" | "request-passcode" | "client-terminated" | "phone-terminated" | "pair" | "paired" | "phone-auth-success" | "authenticate" | "confirm" | "register";
|
|
19
|
-
sessionID: string;
|
|
20
|
-
cipher?: string;
|
|
21
|
-
nonce?: string;
|
|
22
|
-
publicKey?: string;
|
|
23
|
-
url?: string;
|
|
24
|
-
authType?: AuthType;
|
|
25
|
-
projectId?: string;
|
|
26
|
-
grantedAttributes?: {
|
|
27
|
-
[key: string]: boolean;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
export interface IPhone {
|
|
31
|
-
id: number;
|
|
32
|
-
country: string;
|
|
33
|
-
callingCode: string;
|
|
34
|
-
number: string;
|
|
35
|
-
verifiedAt: string;
|
|
36
|
-
verificationProvider: string;
|
|
37
|
-
}
|
|
38
|
-
export interface IEmail {
|
|
39
|
-
id: number;
|
|
40
|
-
value: string;
|
|
41
|
-
verifiedAt: string;
|
|
42
|
-
verificationProvider: string;
|
|
43
|
-
}
|
|
44
|
-
export type IdCardTypes = "national id card" | "passport" | "driver's license" | "residence permit";
|
|
45
|
-
export interface IKycData {
|
|
46
|
-
id: number;
|
|
47
|
-
status?: "Approved" | "Declined" | "In Review";
|
|
48
|
-
document_type?: IdCardTypes;
|
|
49
|
-
document_number?: string;
|
|
50
|
-
personal_number?: string;
|
|
51
|
-
date_of_birth?: string | Date;
|
|
52
|
-
age?: number;
|
|
53
|
-
expiration_date?: string | Date;
|
|
54
|
-
date_of_issue?: string | Date;
|
|
55
|
-
issuing_state?: string;
|
|
56
|
-
issuing_state_name?: string;
|
|
57
|
-
first_name?: string;
|
|
58
|
-
last_name?: string;
|
|
59
|
-
full_name?: string;
|
|
60
|
-
gender?: string;
|
|
61
|
-
address?: string;
|
|
62
|
-
formatted_address?: string;
|
|
63
|
-
place_of_birth?: string;
|
|
64
|
-
marital_status?: string;
|
|
65
|
-
nationality?: string;
|
|
66
|
-
liveness_percentage?: number;
|
|
67
|
-
face_match_percentage?: number;
|
|
68
|
-
verified_at?: string | Date;
|
|
69
|
-
}
|
|
70
|
-
export interface IUserData {
|
|
71
|
-
first_name?: string;
|
|
72
|
-
last_name?: string;
|
|
73
|
-
other_names?: string;
|
|
74
|
-
email?: IEmail;
|
|
75
|
-
phone?: IPhone;
|
|
76
|
-
dob?: string | Date;
|
|
77
|
-
gender?: "male" | "female" | "other";
|
|
78
|
-
country?: string;
|
|
79
|
-
state?: string;
|
|
80
|
-
city?: string;
|
|
81
|
-
address?: string;
|
|
82
|
-
occupation?: string;
|
|
83
|
-
company?: string;
|
|
84
|
-
website?: string;
|
|
85
|
-
}
|
|
86
|
-
export interface IdentityResult {
|
|
87
|
-
user_id: string;
|
|
88
|
-
user_data?: IUserData;
|
|
89
|
-
id_verification: IKycData;
|
|
90
|
-
id_downloadurls?: {
|
|
91
|
-
front_of_card?: string;
|
|
92
|
-
back_of_card?: string;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
export interface PelicanWebAuthProps extends PelicanAuthConfig {
|
|
96
|
-
onClose?: () => void;
|
|
97
|
-
onSuccess: (result: IdentityResult) => void;
|
|
98
|
-
onError?: (error: Error) => void;
|
|
99
|
-
buttonComponent?: React.ReactElement;
|
|
100
|
-
buttonText?: string;
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,iBAAiB,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,cAAc,GACd,eAAe,GACf,QAAQ,GACR,eAAe,GACf,eAAe,GACf,WAAW,GACX,OAAO,GACP,YAAY,CAAC;AAEjB,MAAM,WAAW,iBAAiB;IAKhC,SAAS,EAAE,MAAM,CAAC;IAMlB,SAAS,EAAE,MAAM,CAAC;IAQlB,QAAQ,EAAE,QAAQ,CAAC;IAanB,cAAc,CAAC,EAAE,OAAO,CAAC;IAazB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,gBAAgB,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,IAAI,EACA,WAAW,GACX,kBAAkB,GAClB,mBAAmB,GACnB,kBAAkB,GAClB,MAAM,GACN,QAAQ,GACR,oBAAoB,GACpB,cAAc,GACd,SAAS,GACT,UAAU,CAAC;IAEf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,SAAS,CAAC,EAAE,MAAM,C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B,SAAQ,iBAAiB;IAM5D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAOrB,SAAS,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAO5C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAOjC,eAAe,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAOrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/types/types.js
DELETED
package/dist/types/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
interface EncryptedMessage {
|
|
2
|
-
cipher: string;
|
|
3
|
-
nonce: string;
|
|
4
|
-
}
|
|
5
|
-
export declare class CryptoService {
|
|
6
|
-
generateSymmetricKey(): string;
|
|
7
|
-
encryptSymmetric({ plaintext, keyString, }: {
|
|
8
|
-
plaintext: string;
|
|
9
|
-
keyString: string;
|
|
10
|
-
}): EncryptedMessage;
|
|
11
|
-
decryptSymmetric({ encrypted, keyString, }: {
|
|
12
|
-
encrypted: EncryptedMessage;
|
|
13
|
-
keyString: string;
|
|
14
|
-
}): string | null;
|
|
15
|
-
}
|
|
16
|
-
export default CryptoService;
|
|
17
|
-
export type { EncryptedMessage };
|
|
18
|
-
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/utilities/crypto.ts"],"names":[],"mappings":"AAGA,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,aAAa;IACxB,oBAAoB,IAAI,MAAM;IAY9B,gBAAgB,CAAC,EACf,SAAS,EACT,SAAS,GACV,EAAE;QACD,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,gBAAgB;IAoBpB,gBAAgB,CAAC,EACf,SAAS,EACT,SAAS,GACV,EAAE;QACD,SAAS,EAAE,gBAAgB,CAAC;QAC5B,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,MAAM,GAAG,IAAI;CAmBlB;AAED,eAAe,aAAa,CAAC;AAC7B,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/utilities/crypto.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import nacl from "tweetnacl";
|
|
2
|
-
import { decodeBase64, encodeBase64 } from "tweetnacl-util";
|
|
3
|
-
export class CryptoService {
|
|
4
|
-
generateSymmetricKey() {
|
|
5
|
-
const key = nacl.randomBytes(32);
|
|
6
|
-
return encodeBase64(key);
|
|
7
|
-
}
|
|
8
|
-
encryptSymmetric({ plaintext, keyString, }) {
|
|
9
|
-
const key = decodeBase64(keyString);
|
|
10
|
-
const nonce = nacl.randomBytes(24);
|
|
11
|
-
const messageBytes = new TextEncoder().encode(plaintext);
|
|
12
|
-
const ciphertext = nacl.secretbox(messageBytes, nonce, key);
|
|
13
|
-
return {
|
|
14
|
-
cipher: encodeBase64(ciphertext),
|
|
15
|
-
nonce: encodeBase64(nonce),
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
decryptSymmetric({ encrypted, keyString, }) {
|
|
19
|
-
try {
|
|
20
|
-
const key = decodeBase64(keyString);
|
|
21
|
-
const ciphertextBytes = decodeBase64(encrypted.cipher);
|
|
22
|
-
const nonceBytes = decodeBase64(encrypted.nonce);
|
|
23
|
-
const decrypted = nacl.secretbox.open(ciphertextBytes, nonceBytes, key);
|
|
24
|
-
if (!decrypted) {
|
|
25
|
-
throw new Error("Decryption failed - invalid key or corrupted data");
|
|
26
|
-
}
|
|
27
|
-
const decoded = new TextDecoder().decode(decrypted);
|
|
28
|
-
return decoded;
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
console.error("Decryption failed", error);
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export default CryptoService;
|
|
37
|
-
//# sourceMappingURL=crypto.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/utilities/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAO5D,MAAM,OAAO,aAAa;IACxB,oBAAoB;QAClB,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QACjC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IASD,gBAAgB,CAAC,EACf,SAAS,EACT,SAAS,GAIV;QACC,MAAM,GAAG,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAEnC,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAEzD,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QAE5D,OAAO;YACL,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC;YAChC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;SAC3B,CAAC;IACJ,CAAC;IAQD,gBAAgB,CAAC,EACf,SAAS,EACT,SAAS,GAIV;QACC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;YACpC,MAAM,eAAe,GAAG,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YACvD,MAAM,UAAU,GAAG,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAEjD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;YAExE,IAAI,CAAC,SAAS,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;YACvE,CAAC;YAED,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACpD,OAAO,OAAO,CAAC;QACjB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PelicanAuthState } from "../types/types";
|
|
2
|
-
export declare class StateMachine {
|
|
3
|
-
private state;
|
|
4
|
-
private listeners;
|
|
5
|
-
get current(): PelicanAuthState;
|
|
6
|
-
transition(next: PelicanAuthState): void;
|
|
7
|
-
subscribe(fn: (s: PelicanAuthState) => void): () => boolean;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=stateMachine.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stateMachine.d.ts","sourceRoot":"","sources":["../../src/utilities/stateMachine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAA4B;IACzC,OAAO,CAAC,SAAS,CAA4C;IAE7D,IAAI,OAAO,qBAEV;IAED,UAAU,CAAC,IAAI,EAAE,gBAAgB;IAKjC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,gBAAgB,KAAK,IAAI;CAI5C"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export class StateMachine {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.state = "idle";
|
|
4
|
-
this.listeners = new Set();
|
|
5
|
-
}
|
|
6
|
-
get current() {
|
|
7
|
-
return this.state;
|
|
8
|
-
}
|
|
9
|
-
transition(next) {
|
|
10
|
-
this.state = next;
|
|
11
|
-
this.listeners.forEach((l) => l(next));
|
|
12
|
-
}
|
|
13
|
-
subscribe(fn) {
|
|
14
|
-
this.listeners.add(fn);
|
|
15
|
-
return () => this.listeners.delete(fn);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=stateMachine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stateMachine.js","sourceRoot":"","sources":["../../src/utilities/stateMachine.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IAAzB;QACU,UAAK,GAAqB,MAAM,CAAC;QACjC,cAAS,GAAG,IAAI,GAAG,EAAiC,CAAC;IAe/D,CAAC;IAbC,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,UAAU,CAAC,IAAsB;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;IAED,SAAS,CAAC,EAAiC;QACzC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACvB,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
interface StorageOptions {
|
|
2
|
-
ttlMs?: number;
|
|
3
|
-
useSessionStorage?: boolean;
|
|
4
|
-
}
|
|
5
|
-
declare class AuthStorage {
|
|
6
|
-
private readonly prefix;
|
|
7
|
-
private readonly defaultTTL;
|
|
8
|
-
private memoryCache;
|
|
9
|
-
set(key: string, value: any, options?: StorageOptions): void;
|
|
10
|
-
get(key: string): any | null;
|
|
11
|
-
remove(key: string): void;
|
|
12
|
-
clear(): void;
|
|
13
|
-
private setMemory;
|
|
14
|
-
private getMemory;
|
|
15
|
-
}
|
|
16
|
-
declare const storage: AuthStorage;
|
|
17
|
-
export interface AuthSession {
|
|
18
|
-
sessionId: string;
|
|
19
|
-
sessionKey: string;
|
|
20
|
-
}
|
|
21
|
-
export declare const storeAuthSession: (sessionId: string, sessionKey: string, ttlMs?: number) => void;
|
|
22
|
-
export declare const getAuthSession: () => AuthSession | null;
|
|
23
|
-
export declare const clearAuthSession: () => void;
|
|
24
|
-
export declare const clearAllAuthData: () => void;
|
|
25
|
-
export default storage;
|
|
26
|
-
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/utilities/storage.ts"],"names":[],"mappings":"AAMA,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,cAAM,WAAW;IACf,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiB;IAC5C,OAAO,CAAC,WAAW,CACP;IAKZ,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,GAAE,cAAmB,GAAG,IAAI;IAsBhE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI;IA0B5B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAYzB,KAAK,IAAI,IAAI;IAoBb,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,SAAS;CAWlB;AAGD,QAAA,MAAM,OAAO,aAAoB,CAAC;AAMlC,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,GAC3B,WAAW,MAAM,EACjB,YAAY,MAAM,EAClB,QAAQ,MAAM,KACb,IAEF,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,WAAW,GAAG,IAE/C,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,IAEnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAO,IAEnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
class AuthStorage {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.prefix = "pelican_auth_";
|
|
4
|
-
this.defaultTTL = 5 * 60 * 1000;
|
|
5
|
-
this.memoryCache = new Map();
|
|
6
|
-
}
|
|
7
|
-
set(key, value, options = {}) {
|
|
8
|
-
const { ttlMs = this.defaultTTL, useSessionStorage = true } = options;
|
|
9
|
-
const expiresAt = Date.now() + ttlMs;
|
|
10
|
-
const data = { value, expiresAt };
|
|
11
|
-
if (useSessionStorage) {
|
|
12
|
-
try {
|
|
13
|
-
sessionStorage.setItem(`${this.prefix}${key}`, JSON.stringify(data));
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
console.warn("SessionStorage unavailable, using memory:", error);
|
|
17
|
-
this.setMemory(key, data);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
this.setMemory(key, data);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
get(key) {
|
|
25
|
-
try {
|
|
26
|
-
const stored = sessionStorage.getItem(`${this.prefix}${key}`);
|
|
27
|
-
if (stored) {
|
|
28
|
-
const data = JSON.parse(stored);
|
|
29
|
-
if (Date.now() > data.expiresAt) {
|
|
30
|
-
this.remove(key);
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return data.value;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
}
|
|
38
|
-
return this.getMemory(key);
|
|
39
|
-
}
|
|
40
|
-
remove(key) {
|
|
41
|
-
try {
|
|
42
|
-
sessionStorage.removeItem(`${this.prefix}${key}`);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
}
|
|
46
|
-
this.memoryCache.delete(key);
|
|
47
|
-
}
|
|
48
|
-
clear() {
|
|
49
|
-
try {
|
|
50
|
-
Object.keys(sessionStorage).forEach((key) => {
|
|
51
|
-
if (key.startsWith(this.prefix)) {
|
|
52
|
-
sessionStorage.removeItem(key);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
}
|
|
58
|
-
this.memoryCache.clear();
|
|
59
|
-
}
|
|
60
|
-
setMemory(key, data) {
|
|
61
|
-
this.memoryCache.set(key, data);
|
|
62
|
-
const ttl = data.expiresAt - Date.now();
|
|
63
|
-
setTimeout(() => {
|
|
64
|
-
this.memoryCache.delete(key);
|
|
65
|
-
}, ttl);
|
|
66
|
-
}
|
|
67
|
-
getMemory(key) {
|
|
68
|
-
const data = this.memoryCache.get(key);
|
|
69
|
-
if (!data)
|
|
70
|
-
return null;
|
|
71
|
-
if (Date.now() > data.expiresAt) {
|
|
72
|
-
this.memoryCache.delete(key);
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
return data.value;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
const storage = new AuthStorage();
|
|
79
|
-
export const storeAuthSession = (sessionId, sessionKey, ttlMs) => {
|
|
80
|
-
storage.set("session", { sessionId, sessionKey }, { ttlMs });
|
|
81
|
-
};
|
|
82
|
-
export const getAuthSession = () => {
|
|
83
|
-
return storage.get("session");
|
|
84
|
-
};
|
|
85
|
-
export const clearAuthSession = () => {
|
|
86
|
-
storage.remove("session");
|
|
87
|
-
};
|
|
88
|
-
export const clearAllAuthData = () => {
|
|
89
|
-
storage.clear();
|
|
90
|
-
};
|
|
91
|
-
export default storage;
|
|
92
|
-
//# sourceMappingURL=storage.js.map
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ISocketMessage) => void;
|
|
5
|
-
onError?: (err: Event) => void;
|
|
6
|
-
onClose?: (ev: CloseEvent) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare class Transport {
|
|
9
|
-
private socket?;
|
|
10
|
-
private handlers;
|
|
11
|
-
private reconnectAttempts;
|
|
12
|
-
private maxReconnectAttempts;
|
|
13
|
-
private isExplicitlyClosed;
|
|
14
|
-
private url?;
|
|
15
|
-
constructor(handlers: TransportHandlers);
|
|
16
|
-
connect(url: string): void;
|
|
17
|
-
private attemptReconnect;
|
|
18
|
-
send(payload: ISocketMessage): void;
|
|
19
|
-
close(): void;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/utilities/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,KAAK,iBAAiB,GAAG;IACvB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,CAAY;IAC3B,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,GAAG,CAAC,CAAS;gBAET,QAAQ,EAAE,iBAAiB;IAIvC,OAAO,CAAC,GAAG,EAAE,MAAM;IA8BnB,OAAO,CAAC,gBAAgB;IAaxB,IAAI,CAAC,OAAO,EAAE,cAAc;IAM5B,KAAK;CAIN"}
|