@omni2fa/core 0.6.1
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/Interfaces/IOmni2Fa.d.ts +18 -0
- package/dist/Interfaces/IOmni2Fa.d.ts.map +1 -0
- package/dist/client/Interfaces/ClientCall.d.ts +5 -0
- package/dist/client/Interfaces/ClientCall.d.ts.map +1 -0
- package/dist/client/Interfaces/ClientCallError.d.ts +9 -0
- package/dist/client/Interfaces/ClientCallError.d.ts.map +1 -0
- package/dist/client/Interfaces/ClientCallResult.d.ts +6 -0
- package/dist/client/Interfaces/ClientCallResult.d.ts.map +1 -0
- package/dist/client/Interfaces/IOmni2FaClient.d.ts +26 -0
- package/dist/client/Interfaces/IOmni2FaClient.d.ts.map +1 -0
- package/dist/client/Omni2FaClient.d.ts +36 -0
- package/dist/client/Omni2FaClient.d.ts.map +1 -0
- package/dist/client/Omni2FaClientConfig.d.ts +20 -0
- package/dist/client/Omni2FaClientConfig.d.ts.map +1 -0
- package/dist/createOmni2Fa.d.ts +8 -0
- package/dist/createOmni2Fa.d.ts.map +1 -0
- package/dist/errors/Omni2FaApiError.d.ts +12 -0
- package/dist/errors/Omni2FaApiError.d.ts.map +1 -0
- package/dist/errors/codes.d.ts +20 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/messages.d.ts +2 -0
- package/dist/errors/messages.d.ts.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +915 -0
- package/dist/index.js.map +1 -0
- package/dist/machines/challenge/ChallengeContext.d.ts +16 -0
- package/dist/machines/challenge/ChallengeContext.d.ts.map +1 -0
- package/dist/machines/challenge/ChallengeEvent.d.ts +16 -0
- package/dist/machines/challenge/ChallengeEvent.d.ts.map +1 -0
- package/dist/machines/challenge/challengeMachine.d.ts +105 -0
- package/dist/machines/challenge/challengeMachine.d.ts.map +1 -0
- package/dist/machines/emailEnrollment/EmailEnrollmentContext.d.ts +15 -0
- package/dist/machines/emailEnrollment/EmailEnrollmentContext.d.ts.map +1 -0
- package/dist/machines/emailEnrollment/EmailEnrollmentEvent.d.ts +14 -0
- package/dist/machines/emailEnrollment/EmailEnrollmentEvent.d.ts.map +1 -0
- package/dist/machines/emailEnrollment/emailEnrollmentMachine.d.ts +71 -0
- package/dist/machines/emailEnrollment/emailEnrollmentMachine.d.ts.map +1 -0
- package/dist/machines/methods/MethodsContext.d.ts +8 -0
- package/dist/machines/methods/MethodsContext.d.ts.map +1 -0
- package/dist/machines/methods/MethodsEvent.d.ts +10 -0
- package/dist/machines/methods/MethodsEvent.d.ts.map +1 -0
- package/dist/machines/methods/methodsMachine.d.ts +43 -0
- package/dist/machines/methods/methodsMachine.d.ts.map +1 -0
- package/dist/machines/totpEnrollment/TotpEnrollmentContext.d.ts +12 -0
- package/dist/machines/totpEnrollment/TotpEnrollmentContext.d.ts.map +1 -0
- package/dist/machines/totpEnrollment/TotpEnrollmentEvent.d.ts +11 -0
- package/dist/machines/totpEnrollment/TotpEnrollmentEvent.d.ts.map +1 -0
- package/dist/machines/totpEnrollment/totpEnrollmentMachine.d.ts +50 -0
- package/dist/machines/totpEnrollment/totpEnrollmentMachine.d.ts.map +1 -0
- package/dist/machines/webauthnEnrollment/WebAuthnEnrollmentContext.d.ts +12 -0
- package/dist/machines/webauthnEnrollment/WebAuthnEnrollmentContext.d.ts.map +1 -0
- package/dist/machines/webauthnEnrollment/WebAuthnEnrollmentEvent.d.ts +10 -0
- package/dist/machines/webauthnEnrollment/WebAuthnEnrollmentEvent.d.ts.map +1 -0
- package/dist/machines/webauthnEnrollment/webauthnEnrollmentMachine.d.ts +47 -0
- package/dist/machines/webauthnEnrollment/webauthnEnrollmentMachine.d.ts.map +1 -0
- package/dist/storage/Interfaces/IStorage.d.ts +10 -0
- package/dist/storage/Interfaces/IStorage.d.ts.map +1 -0
- package/dist/storage/LocalStorageStorage.d.ts +8 -0
- package/dist/storage/LocalStorageStorage.d.ts.map +1 -0
- package/dist/storage/MemoryStorage.d.ts +9 -0
- package/dist/storage/MemoryStorage.d.ts.map +1 -0
- package/dist/storage/SessionStorageStorage.d.ts +8 -0
- package/dist/storage/SessionStorageStorage.d.ts.map +1 -0
- package/dist/types/api.d.ts +1075 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/dtos.d.ts +29 -0
- package/dist/types/dtos.d.ts.map +1 -0
- package/dist/webauthn/base64url.d.ts +4 -0
- package/dist/webauthn/base64url.d.ts.map +1 -0
- package/dist/webauthn/ceremony.d.ts +5 -0
- package/dist/webauthn/ceremony.d.ts.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ActorRefFrom } from 'xstate';
|
|
2
|
+
import { IOmni2FaClient } from '../../client/Interfaces/IOmni2FaClient';
|
|
3
|
+
import { TotpEnrollmentContext } from './TotpEnrollmentContext';
|
|
4
|
+
import { TotpEnrollmentEvent } from './TotpEnrollmentEvent';
|
|
5
|
+
export declare function createTotpEnrollmentMachine(client: IOmni2FaClient): import('xstate').StateMachine<TotpEnrollmentContext, TotpEnrollmentEvent, {
|
|
6
|
+
[x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<{
|
|
7
|
+
enrollmentId: string;
|
|
8
|
+
otpAuthUri: string;
|
|
9
|
+
secret: string;
|
|
10
|
+
}, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<{
|
|
11
|
+
methodId: string;
|
|
12
|
+
recoveryCodes?: string[] | null;
|
|
13
|
+
}, {
|
|
14
|
+
enrollmentId: string;
|
|
15
|
+
code: string;
|
|
16
|
+
name: string | null;
|
|
17
|
+
}, import('xstate').EventObject>> | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
src: "startEnrollment";
|
|
20
|
+
logic: import('xstate').PromiseActorLogic<{
|
|
21
|
+
enrollmentId: string;
|
|
22
|
+
otpAuthUri: string;
|
|
23
|
+
secret: string;
|
|
24
|
+
}, import('xstate').NonReducibleUnknown, import('xstate').EventObject>;
|
|
25
|
+
id: string | undefined;
|
|
26
|
+
} | {
|
|
27
|
+
src: "confirmEnrollment";
|
|
28
|
+
logic: import('xstate').PromiseActorLogic<{
|
|
29
|
+
methodId: string;
|
|
30
|
+
recoveryCodes?: string[] | null;
|
|
31
|
+
}, {
|
|
32
|
+
enrollmentId: string;
|
|
33
|
+
code: string;
|
|
34
|
+
name: string | null;
|
|
35
|
+
}, import('xstate').EventObject>;
|
|
36
|
+
id: string | undefined;
|
|
37
|
+
}, never, never, never, "idle" | "starting" | "awaitingCode" | "failed" | "confirming" | "enrolled", string, import('xstate').NonReducibleUnknown, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
|
|
38
|
+
id: "totpEnrollment";
|
|
39
|
+
states: {
|
|
40
|
+
readonly idle: {};
|
|
41
|
+
readonly starting: {};
|
|
42
|
+
readonly awaitingCode: {};
|
|
43
|
+
readonly confirming: {};
|
|
44
|
+
readonly enrolled: {};
|
|
45
|
+
readonly failed: {};
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
48
|
+
export type TotpEnrollmentMachine = ReturnType<typeof createTotpEnrollmentMachine>;
|
|
49
|
+
export type TotpEnrollmentActor = ActorRefFrom<TotpEnrollmentMachine>;
|
|
50
|
+
//# sourceMappingURL=totpEnrollmentMachine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totpEnrollmentMachine.d.ts","sourceRoot":"","sources":["../../../src/machines/totpEnrollment/totpEnrollmentMachine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAE7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAYjE,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,cAAc;;;;;;;;;sBAcoB,MAAM;cAAQ,MAAM;cAAQ,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;sBAAzC,MAAM;cAAQ,MAAM;cAAQ,MAAM,GAAG,IAAI;;;;;;;;;;;;;GAmF9H;AAsBD,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACnF,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Snapshot context of <see cref="createWebAuthnEnrollmentMachine"/>. */
|
|
2
|
+
export interface WebAuthnEnrollmentContext {
|
|
3
|
+
enrollmentId: string | null;
|
|
4
|
+
optionsJson: string | null;
|
|
5
|
+
name: string | null;
|
|
6
|
+
methodId: string | null;
|
|
7
|
+
/** Recovery codes returned if this was the user's first method — shown once. Null otherwise. */
|
|
8
|
+
recoveryCodes: string[] | null;
|
|
9
|
+
errorCode: string | null;
|
|
10
|
+
errorMessage: string | null;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=WebAuthnEnrollmentContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebAuthnEnrollmentContext.d.ts","sourceRoot":"","sources":["../../../src/machines/webauthnEnrollment/WebAuthnEnrollmentContext.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,WAAW,yBAAyB;IACtC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gGAAgG;IAChG,aAAa,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Events accepted by <see cref="createWebAuthnEnrollmentMachine"/>. */
|
|
2
|
+
export type WebAuthnEnrollmentEvent = {
|
|
3
|
+
type: 'start';
|
|
4
|
+
name?: string | undefined;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'retry';
|
|
7
|
+
} | {
|
|
8
|
+
type: 'reset';
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=WebAuthnEnrollmentEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebAuthnEnrollmentEvent.d.ts","sourceRoot":"","sources":["../../../src/machines/webauthnEnrollment/WebAuthnEnrollmentEvent.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,MAAM,uBAAuB,GAC7B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ActorRefFrom } from 'xstate';
|
|
2
|
+
import { IOmni2FaClient } from '../../client/Interfaces/IOmni2FaClient';
|
|
3
|
+
import { WebAuthnEnrollmentContext } from './WebAuthnEnrollmentContext';
|
|
4
|
+
import { WebAuthnEnrollmentEvent } from './WebAuthnEnrollmentEvent';
|
|
5
|
+
export declare function createWebAuthnEnrollmentMachine(client: IOmni2FaClient): import('xstate').StateMachine<WebAuthnEnrollmentContext, WebAuthnEnrollmentEvent, {
|
|
6
|
+
[x: string]: import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<{
|
|
7
|
+
enrollmentId: string;
|
|
8
|
+
optionsJson: string;
|
|
9
|
+
}, import('xstate').NonReducibleUnknown, import('xstate').EventObject>> | import('xstate').ActorRefFromLogic<import('xstate').PromiseActorLogic<{
|
|
10
|
+
methodId: string;
|
|
11
|
+
recoveryCodes?: string[] | null;
|
|
12
|
+
}, {
|
|
13
|
+
enrollmentId: string;
|
|
14
|
+
optionsJson: string;
|
|
15
|
+
name: string | null;
|
|
16
|
+
}, import('xstate').EventObject>> | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
src: "startEnrollment";
|
|
19
|
+
logic: import('xstate').PromiseActorLogic<{
|
|
20
|
+
enrollmentId: string;
|
|
21
|
+
optionsJson: string;
|
|
22
|
+
}, import('xstate').NonReducibleUnknown, import('xstate').EventObject>;
|
|
23
|
+
id: string | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
src: "registerAndConfirm";
|
|
26
|
+
logic: import('xstate').PromiseActorLogic<{
|
|
27
|
+
methodId: string;
|
|
28
|
+
recoveryCodes?: string[] | null;
|
|
29
|
+
}, {
|
|
30
|
+
enrollmentId: string;
|
|
31
|
+
optionsJson: string;
|
|
32
|
+
name: string | null;
|
|
33
|
+
}, import('xstate').EventObject>;
|
|
34
|
+
id: string | undefined;
|
|
35
|
+
}, never, never, never, "idle" | "starting" | "failed" | "enrolled" | "registering", string, import('xstate').NonReducibleUnknown, import('xstate').NonReducibleUnknown, import('xstate').EventObject, import('xstate').MetaObject, {
|
|
36
|
+
id: "webauthnEnrollment";
|
|
37
|
+
states: {
|
|
38
|
+
readonly idle: {};
|
|
39
|
+
readonly starting: {};
|
|
40
|
+
readonly registering: {};
|
|
41
|
+
readonly enrolled: {};
|
|
42
|
+
readonly failed: {};
|
|
43
|
+
};
|
|
44
|
+
}>;
|
|
45
|
+
export type WebAuthnEnrollmentMachine = ReturnType<typeof createWebAuthnEnrollmentMachine>;
|
|
46
|
+
export type WebAuthnEnrollmentActor = ActorRefFrom<WebAuthnEnrollmentMachine>;
|
|
47
|
+
//# sourceMappingURL=webauthnEnrollmentMachine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webauthnEnrollmentMachine.d.ts","sourceRoot":"","sources":["../../../src/machines/webauthnEnrollment/webauthnEnrollmentMachine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAG7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAYzE,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,cAAc;;;;;;;;sBAciB,MAAM;qBAAe,MAAM;cAAQ,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;sBAAhD,MAAM;qBAAe,MAAM;cAAQ,MAAM,GAAG,IAAI;;;;;;;;;;;;GAiFtI;AAsBD,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAC3F,MAAM,MAAM,uBAAuB,GAAG,YAAY,CAAC,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistence boundary for short-lived 2FA-related values (most notably the pre-auth token).
|
|
3
|
+
* Implementations choose where to keep values: in-memory, sessionStorage, localStorage, cookies, etc.
|
|
4
|
+
*/
|
|
5
|
+
export interface IStorage {
|
|
6
|
+
get(key: string): string | null;
|
|
7
|
+
set(key: string, value: string): void;
|
|
8
|
+
remove(key: string): void;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=IStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IStorage.d.ts","sourceRoot":"","sources":["../../../src/storage/Interfaces/IStorage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACrB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IStorage } from './Interfaces/IStorage';
|
|
2
|
+
/** Browser <c>localStorage</c>. Values persist indefinitely across sessions. Use with caution for sensitive data. */
|
|
3
|
+
export declare class LocalStorageStorage implements IStorage {
|
|
4
|
+
get(key: string): string | null;
|
|
5
|
+
set(key: string, value: string): void;
|
|
6
|
+
remove(key: string): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=LocalStorageStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalStorageStorage.d.ts","sourceRoot":"","sources":["../../src/storage/LocalStorageStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,qHAAqH;AACrH,qBAAa,mBAAoB,YAAW,QAAQ;IAChD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAI/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIrC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAG5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IStorage } from './Interfaces/IStorage';
|
|
2
|
+
/** In-process storage. Default. Values vanish on page reload — safest default. */
|
|
3
|
+
export declare class MemoryStorage implements IStorage {
|
|
4
|
+
private readonly map;
|
|
5
|
+
get(key: string): string | null;
|
|
6
|
+
set(key: string, value: string): void;
|
|
7
|
+
remove(key: string): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=MemoryStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemoryStorage.d.ts","sourceRoot":"","sources":["../../src/storage/MemoryStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,kFAAkF;AAClF,qBAAa,aAAc,YAAW,QAAQ;IAC1C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAA6B;IAEjD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAI/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIrC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAG5B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IStorage } from './Interfaces/IStorage';
|
|
2
|
+
/** Browser <c>sessionStorage</c>. Values persist across page reloads in the same tab, gone when tab closes. */
|
|
3
|
+
export declare class SessionStorageStorage implements IStorage {
|
|
4
|
+
get(key: string): string | null;
|
|
5
|
+
set(key: string, value: string): void;
|
|
6
|
+
remove(key: string): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=SessionStorageStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionStorageStorage.d.ts","sourceRoot":"","sources":["../../src/storage/SessionStorageStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,+GAA+G;AAC/G,qBAAa,qBAAsB,YAAW,QAAQ;IAClD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAI/B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIrC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAG5B"}
|