@authhero/adapter-interfaces 0.3.0 → 0.4.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.
@@ -1808,27 +1808,215 @@ export interface LoginState {
1808
1808
  state: string;
1809
1809
  errorMessage?: string;
1810
1810
  }
1811
- export interface OTP {
1811
+ export declare const otpInsertSchema: z.ZodObject<{
1812
+ id: z.ZodString;
1813
+ tenant_id: z.ZodString;
1814
+ client_id: z.ZodString;
1815
+ email: z.ZodString;
1816
+ code: z.ZodString;
1817
+ ip: z.ZodOptional<z.ZodString>;
1818
+ send: z.ZodOptional<z.ZodString>;
1819
+ authParams: z.ZodObject<{
1820
+ client_id: z.ZodString;
1821
+ vendor_id: z.ZodOptional<z.ZodString>;
1822
+ response_type: z.ZodOptional<z.ZodNativeEnum<typeof AuthorizationResponseType>>;
1823
+ response_mode: z.ZodOptional<z.ZodNativeEnum<typeof AuthorizationResponseMode>>;
1824
+ redirect_uri: z.ZodOptional<z.ZodString>;
1825
+ audience: z.ZodOptional<z.ZodString>;
1826
+ state: z.ZodOptional<z.ZodString>;
1827
+ nonce: z.ZodOptional<z.ZodString>;
1828
+ scope: z.ZodOptional<z.ZodString>;
1829
+ code_challenge_method: z.ZodOptional<z.ZodNativeEnum<typeof CodeChallengeMethod>>;
1830
+ code_challenge: z.ZodOptional<z.ZodString>;
1831
+ username: z.ZodOptional<z.ZodString>;
1832
+ }, "strip", z.ZodTypeAny, {
1833
+ client_id: string;
1834
+ username?: string | undefined;
1835
+ audience?: string | undefined;
1836
+ scope?: string | undefined;
1837
+ vendor_id?: string | undefined;
1838
+ response_type?: AuthorizationResponseType | undefined;
1839
+ response_mode?: AuthorizationResponseMode | undefined;
1840
+ redirect_uri?: string | undefined;
1841
+ state?: string | undefined;
1842
+ nonce?: string | undefined;
1843
+ code_challenge_method?: CodeChallengeMethod | undefined;
1844
+ code_challenge?: string | undefined;
1845
+ }, {
1846
+ client_id: string;
1847
+ username?: string | undefined;
1848
+ audience?: string | undefined;
1849
+ scope?: string | undefined;
1850
+ vendor_id?: string | undefined;
1851
+ response_type?: AuthorizationResponseType | undefined;
1852
+ response_mode?: AuthorizationResponseMode | undefined;
1853
+ redirect_uri?: string | undefined;
1854
+ state?: string | undefined;
1855
+ nonce?: string | undefined;
1856
+ code_challenge_method?: CodeChallengeMethod | undefined;
1857
+ code_challenge?: string | undefined;
1858
+ }>;
1859
+ expires_at: z.ZodString;
1860
+ used_at: z.ZodOptional<z.ZodString>;
1861
+ user_id: z.ZodOptional<z.ZodString>;
1862
+ }, "strip", z.ZodTypeAny, {
1863
+ code: string;
1864
+ email: string;
1865
+ client_id: string;
1812
1866
  id: string;
1867
+ authParams: {
1868
+ client_id: string;
1869
+ username?: string | undefined;
1870
+ audience?: string | undefined;
1871
+ scope?: string | undefined;
1872
+ vendor_id?: string | undefined;
1873
+ response_type?: AuthorizationResponseType | undefined;
1874
+ response_mode?: AuthorizationResponseMode | undefined;
1875
+ redirect_uri?: string | undefined;
1876
+ state?: string | undefined;
1877
+ nonce?: string | undefined;
1878
+ code_challenge_method?: CodeChallengeMethod | undefined;
1879
+ code_challenge?: string | undefined;
1880
+ };
1881
+ expires_at: string;
1813
1882
  tenant_id: string;
1883
+ user_id?: string | undefined;
1884
+ ip?: string | undefined;
1885
+ used_at?: string | undefined;
1886
+ send?: string | undefined;
1887
+ }, {
1888
+ code: string;
1889
+ email: string;
1814
1890
  client_id: string;
1891
+ id: string;
1892
+ authParams: {
1893
+ client_id: string;
1894
+ username?: string | undefined;
1895
+ audience?: string | undefined;
1896
+ scope?: string | undefined;
1897
+ vendor_id?: string | undefined;
1898
+ response_type?: AuthorizationResponseType | undefined;
1899
+ response_mode?: AuthorizationResponseMode | undefined;
1900
+ redirect_uri?: string | undefined;
1901
+ state?: string | undefined;
1902
+ nonce?: string | undefined;
1903
+ code_challenge_method?: CodeChallengeMethod | undefined;
1904
+ code_challenge?: string | undefined;
1905
+ };
1906
+ expires_at: string;
1907
+ tenant_id: string;
1908
+ user_id?: string | undefined;
1909
+ ip?: string | undefined;
1910
+ used_at?: string | undefined;
1911
+ send?: string | undefined;
1912
+ }>;
1913
+ export type OTPInsert = z.infer<typeof otpInsertSchema>;
1914
+ export declare const otpSchema: z.ZodObject<{
1915
+ id: z.ZodString;
1916
+ tenant_id: z.ZodString;
1917
+ client_id: z.ZodString;
1918
+ email: z.ZodString;
1919
+ code: z.ZodString;
1920
+ ip: z.ZodOptional<z.ZodString>;
1921
+ send: z.ZodOptional<z.ZodString>;
1922
+ authParams: z.ZodObject<{
1923
+ client_id: z.ZodString;
1924
+ vendor_id: z.ZodOptional<z.ZodString>;
1925
+ response_type: z.ZodOptional<z.ZodNativeEnum<typeof AuthorizationResponseType>>;
1926
+ response_mode: z.ZodOptional<z.ZodNativeEnum<typeof AuthorizationResponseMode>>;
1927
+ redirect_uri: z.ZodOptional<z.ZodString>;
1928
+ audience: z.ZodOptional<z.ZodString>;
1929
+ state: z.ZodOptional<z.ZodString>;
1930
+ nonce: z.ZodOptional<z.ZodString>;
1931
+ scope: z.ZodOptional<z.ZodString>;
1932
+ code_challenge_method: z.ZodOptional<z.ZodNativeEnum<typeof CodeChallengeMethod>>;
1933
+ code_challenge: z.ZodOptional<z.ZodString>;
1934
+ username: z.ZodOptional<z.ZodString>;
1935
+ }, "strip", z.ZodTypeAny, {
1936
+ client_id: string;
1937
+ username?: string | undefined;
1938
+ audience?: string | undefined;
1939
+ scope?: string | undefined;
1940
+ vendor_id?: string | undefined;
1941
+ response_type?: AuthorizationResponseType | undefined;
1942
+ response_mode?: AuthorizationResponseMode | undefined;
1943
+ redirect_uri?: string | undefined;
1944
+ state?: string | undefined;
1945
+ nonce?: string | undefined;
1946
+ code_challenge_method?: CodeChallengeMethod | undefined;
1947
+ code_challenge?: string | undefined;
1948
+ }, {
1949
+ client_id: string;
1950
+ username?: string | undefined;
1951
+ audience?: string | undefined;
1952
+ scope?: string | undefined;
1953
+ vendor_id?: string | undefined;
1954
+ response_type?: AuthorizationResponseType | undefined;
1955
+ response_mode?: AuthorizationResponseMode | undefined;
1956
+ redirect_uri?: string | undefined;
1957
+ state?: string | undefined;
1958
+ nonce?: string | undefined;
1959
+ code_challenge_method?: CodeChallengeMethod | undefined;
1960
+ code_challenge?: string | undefined;
1961
+ }>;
1962
+ expires_at: z.ZodString;
1963
+ used_at: z.ZodOptional<z.ZodString>;
1964
+ user_id: z.ZodOptional<z.ZodString>;
1965
+ created_at: z.ZodString;
1966
+ }, "strip", z.ZodTypeAny, {
1967
+ code: string;
1968
+ created_at: string;
1815
1969
  email: string;
1970
+ client_id: string;
1971
+ id: string;
1972
+ authParams: {
1973
+ client_id: string;
1974
+ username?: string | undefined;
1975
+ audience?: string | undefined;
1976
+ scope?: string | undefined;
1977
+ vendor_id?: string | undefined;
1978
+ response_type?: AuthorizationResponseType | undefined;
1979
+ response_mode?: AuthorizationResponseMode | undefined;
1980
+ redirect_uri?: string | undefined;
1981
+ state?: string | undefined;
1982
+ nonce?: string | undefined;
1983
+ code_challenge_method?: CodeChallengeMethod | undefined;
1984
+ code_challenge?: string | undefined;
1985
+ };
1986
+ expires_at: string;
1987
+ tenant_id: string;
1988
+ user_id?: string | undefined;
1989
+ ip?: string | undefined;
1990
+ used_at?: string | undefined;
1991
+ send?: string | undefined;
1992
+ }, {
1816
1993
  code: string;
1817
- ip?: string;
1818
- send: "link" | "code";
1994
+ created_at: string;
1995
+ email: string;
1996
+ client_id: string;
1997
+ id: string;
1819
1998
  authParams: {
1820
- nonce?: string;
1821
- state?: string;
1822
- scope?: string;
1823
- response_type?: AuthorizationResponseType;
1824
- response_mode?: AuthorizationResponseMode;
1825
- redirect_uri?: string;
1999
+ client_id: string;
2000
+ username?: string | undefined;
2001
+ audience?: string | undefined;
2002
+ scope?: string | undefined;
2003
+ vendor_id?: string | undefined;
2004
+ response_type?: AuthorizationResponseType | undefined;
2005
+ response_mode?: AuthorizationResponseMode | undefined;
2006
+ redirect_uri?: string | undefined;
2007
+ state?: string | undefined;
2008
+ nonce?: string | undefined;
2009
+ code_challenge_method?: CodeChallengeMethod | undefined;
2010
+ code_challenge?: string | undefined;
1826
2011
  };
1827
- created_at: Date;
1828
- expires_at: Date;
1829
- used_at?: string;
1830
- user_id?: string;
1831
- }
2012
+ expires_at: string;
2013
+ tenant_id: string;
2014
+ user_id?: string | undefined;
2015
+ ip?: string | undefined;
2016
+ used_at?: string | undefined;
2017
+ send?: string | undefined;
2018
+ }>;
2019
+ export type OTP = z.infer<typeof otpSchema>;
1832
2020
  export interface PasswordResponse {
1833
2021
  valid: boolean;
1834
2022
  message: string;
@@ -2389,23 +2577,15 @@ export interface CodesAdapter {
2389
2577
  list: (tenant_id: string, user_id: string) => Promise<Code[]>;
2390
2578
  }
2391
2579
  export interface OTPAdapter {
2392
- create: (authCode: OTP) => Promise<void>;
2580
+ create: (tenant_id: string, authCode: OTPInsert) => Promise<void>;
2393
2581
  list: (tenant_id: string, email: string) => Promise<OTP[]>;
2394
- remove: (tenant_id: string, id: string) => Promise<void>;
2582
+ remove: (tenant_id: string, id: string) => Promise<boolean>;
2395
2583
  }
2396
2584
  export interface PasswordsAdapter {
2397
2585
  create: (tenant_id: string, params: PasswordParams) => Promise<void>;
2398
2586
  update: (tenant_id: string, params: PasswordParams) => Promise<boolean>;
2399
2587
  validate: (tenant_id: string, params: PasswordParams) => Promise<PasswordResponse>;
2400
2588
  }
2401
- export interface SessionsAdapter {
2402
- create: (tenant_id: string, session: SessionInsert) => Promise<Session>;
2403
- get: (tenant_id: string, id: string) => Promise<Session | null>;
2404
- update: (tenant_id: string, id: string, session: {
2405
- used_at: string;
2406
- }) => Promise<boolean>;
2407
- remove: (tenant_id: string, id: string) => Promise<boolean>;
2408
- }
2409
2589
  export interface ListParams {
2410
2590
  page: number;
2411
2591
  per_page: number;
@@ -2416,6 +2596,18 @@ export interface ListParams {
2416
2596
  sort_order: "asc" | "desc";
2417
2597
  };
2418
2598
  }
2599
+ export interface ListSesssionsResponse extends Totals {
2600
+ sessions: Session[];
2601
+ }
2602
+ export interface SessionsAdapter {
2603
+ create: (tenant_id: string, session: SessionInsert) => Promise<Session>;
2604
+ get: (tenant_id: string, id: string) => Promise<Session | null>;
2605
+ list(tenantId: string, params: ListParams): Promise<ListSesssionsResponse>;
2606
+ update: (tenant_id: string, id: string, session: {
2607
+ used_at: string;
2608
+ }) => Promise<boolean>;
2609
+ remove: (tenant_id: string, id: string) => Promise<boolean>;
2610
+ }
2419
2611
  export interface CreateTenantParams {
2420
2612
  name: string;
2421
2613
  audience: string;