@symbiote-native/apple-authentication 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +264 -2
- package/build/angular/apple-authentication-button/index.d.ts +12 -0
- package/build/angular/apple-authentication-button/index.js +98 -0
- package/build/angular/index.d.ts +2 -0
- package/build/angular/index.js +3 -0
- package/build/core/apple-authentication-button.d.ts +20 -0
- package/build/core/apple-authentication-button.js +28 -0
- package/build/core/apple-authentication.d.ts +34 -0
- package/build/core/apple-authentication.js +85 -0
- package/build/core/constants.d.ts +2 -0
- package/build/core/constants.js +3 -0
- package/build/core/index.d.ts +5 -0
- package/build/core/index.js +4 -0
- package/build/core/native-module.d.ts +10 -0
- package/build/core/native-module.js +8 -0
- package/build/core/types.d.ts +104 -0
- package/build/core/types.js +56 -0
- package/build/react/apple-authentication-button.d.ts +6 -0
- package/build/react/apple-authentication-button.js +7 -0
- package/build/react/index.d.ts +3 -0
- package/build/react/index.js +3 -0
- package/build/solid/apple-authentication-button.d.ts +3 -0
- package/build/solid/apple-authentication-button.js +4 -0
- package/build/solid/index.d.ts +3 -0
- package/build/solid/index.js +3 -0
- package/build/svelte/apple-authentication-button.svelte +17 -0
- package/build/svelte/apple-authentication-button.svelte.d.ts +4 -0
- package/build/svelte/index.d.ts +2 -0
- package/build/svelte/index.js +3 -0
- package/build/vue/apple-authentication-button.d.ts +3 -0
- package/build/vue/apple-authentication-button.js +15 -0
- package/build/vue/index.d.ts +3 -0
- package/build/vue/index.js +3 -0
- package/build-ngc/angular/apple-authentication-button/index.d.ts +15 -0
- package/build-ngc/angular/apple-authentication-button/index.js +48 -0
- package/build-ngc/angular/apple-authentication-button/index.js.map +1 -0
- package/build-ngc/angular/index.d.ts +2 -0
- package/build-ngc/angular/index.js +4 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/core/apple-authentication-button.d.ts +20 -0
- package/build-ngc/core/apple-authentication-button.js +29 -0
- package/build-ngc/core/apple-authentication-button.js.map +1 -0
- package/build-ngc/core/apple-authentication.d.ts +34 -0
- package/build-ngc/core/apple-authentication.js +86 -0
- package/build-ngc/core/apple-authentication.js.map +1 -0
- package/build-ngc/core/constants.d.ts +2 -0
- package/build-ngc/core/constants.js +4 -0
- package/build-ngc/core/constants.js.map +1 -0
- package/build-ngc/core/index.d.ts +5 -0
- package/build-ngc/core/index.js +5 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +10 -0
- package/build-ngc/core/native-module.js +9 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/types.d.ts +104 -0
- package/build-ngc/core/types.js +57 -0
- package/build-ngc/core/types.js.map +1 -0
- package/native-link.json +11 -0
- package/package.json +145 -3
- package/src/angular/apple-authentication-button/index.ts +36 -0
- package/src/angular/index.ts +28 -0
- package/src/core/apple-authentication-button.ts +69 -0
- package/src/core/apple-authentication.ts +130 -0
- package/src/core/constants.ts +5 -0
- package/src/core/index.ts +31 -0
- package/src/core/native-module.ts +38 -0
- package/src/core/types.ts +121 -0
- package/src/react/apple-authentication-button.ts +12 -0
- package/src/react/index.ts +28 -0
- package/src/solid/apple-authentication-button.ts +9 -0
- package/src/solid/index.ts +28 -0
- package/src/svelte/apple-authentication-button.svelte +17 -0
- package/src/svelte/index.ts +4 -0
- package/src/svelte/svelte-ambient.d.ts +3 -0
- package/src/svelte/svelte-compile.test-helper.ts +6 -0
- package/src/vue/apple-authentication-button.ts +18 -0
- package/src/vue/index.ts +28 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Типы и enum-ы `expo-apple-authentication`, порт `AppleAuthentication.types.ts`
|
|
2
|
+
|
|
3
|
+
/** Scopes for `signInAsync`, the user may deny any of them, so handle `null` fields */
|
|
4
|
+
export enum AppleAuthenticationScope {
|
|
5
|
+
FULL_NAME = 0,
|
|
6
|
+
EMAIL = 1,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum AppleAuthenticationOperation {
|
|
10
|
+
/** An operation that depends on the particular kind of credential provider */
|
|
11
|
+
IMPLICIT = 0,
|
|
12
|
+
LOGIN = 1,
|
|
13
|
+
REFRESH = 2,
|
|
14
|
+
LOGOUT = 3,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The state of a credential checked with `getCredentialStateAsync` */
|
|
18
|
+
export enum AppleAuthenticationCredentialState {
|
|
19
|
+
REVOKED,
|
|
20
|
+
AUTHORIZED,
|
|
21
|
+
NOT_FOUND,
|
|
22
|
+
TRANSFERRED,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The system's guess of how likely the user is a real person */
|
|
26
|
+
export enum AppleAuthenticationUserDetectionStatus {
|
|
27
|
+
/** The system does not support this determination and there is no data */
|
|
28
|
+
UNSUPPORTED,
|
|
29
|
+
/** The system has not determined whether the user might be a real person */
|
|
30
|
+
UNKNOWN,
|
|
31
|
+
/** The user appears to be a real person */
|
|
32
|
+
LIKELY_REAL,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Which pre-defined text the button shows */
|
|
36
|
+
export enum AppleAuthenticationButtonType {
|
|
37
|
+
/** "Sign in with Apple" */
|
|
38
|
+
SIGN_IN,
|
|
39
|
+
/** "Continue with Apple" */
|
|
40
|
+
CONTINUE,
|
|
41
|
+
/**
|
|
42
|
+
* "Sign up with Apple"
|
|
43
|
+
* @platform ios 13.2+
|
|
44
|
+
*/
|
|
45
|
+
SIGN_UP,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Which pre-defined color scheme the button uses */
|
|
49
|
+
export enum AppleAuthenticationButtonStyle {
|
|
50
|
+
/** White button with black text */
|
|
51
|
+
WHITE,
|
|
52
|
+
/** White button with a black outline and black text */
|
|
53
|
+
WHITE_OUTLINE,
|
|
54
|
+
/** Black button with white text */
|
|
55
|
+
BLACK,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** The style a name is formatted in, see `formatFullName` */
|
|
59
|
+
export type IAppleAuthenticationFullNameFormatStyle =
|
|
60
|
+
'default' | 'short' | 'medium' | 'long' | 'abbreviated';
|
|
61
|
+
|
|
62
|
+
/** The tokenized portions of the user's name, only what the user allowed is not `null` */
|
|
63
|
+
export type IAppleAuthenticationFullName = {
|
|
64
|
+
namePrefix: string | null;
|
|
65
|
+
givenName: string | null;
|
|
66
|
+
middleName: string | null;
|
|
67
|
+
familyName: string | null;
|
|
68
|
+
nameSuffix: string | null;
|
|
69
|
+
nickname: string | null;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type IRequestOptions = {
|
|
73
|
+
/**
|
|
74
|
+
* Scopes the app asks for, they come only the first time a user signs in
|
|
75
|
+
* @default []
|
|
76
|
+
*/
|
|
77
|
+
requestedScopes?: AppleAuthenticationScope[];
|
|
78
|
+
/** An arbitrary string returned unmodified in the credential, it guards against replay attacks */
|
|
79
|
+
state?: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** Options for `signInAsync`, none is required */
|
|
83
|
+
export type IAppleAuthenticationSignInOptions = IRequestOptions & {
|
|
84
|
+
/** An arbitrary string that prevents replay attacks */
|
|
85
|
+
nonce?: string;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** Options for `refreshAsync`, `user` is the id of the user whose credentials refresh */
|
|
89
|
+
export type IAppleAuthenticationRefreshOptions = IRequestOptions & {
|
|
90
|
+
user: string;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** Options for `signOutAsync`, `user` is the id of the user to sign out */
|
|
94
|
+
export type IAppleAuthenticationSignOutOptions = {
|
|
95
|
+
user: string;
|
|
96
|
+
state?: string;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** What a successful `signInAsync`, `refreshAsync` or `signOutAsync` resolves with */
|
|
100
|
+
export type IAppleAuthenticationCredential = {
|
|
101
|
+
/** Stable across apps of one development team, use it to check the user later */
|
|
102
|
+
user: string;
|
|
103
|
+
/** The `state` the request carried, `null` when none was given */
|
|
104
|
+
state: string | null;
|
|
105
|
+
/** `null` without the `FULL_NAME` scope, on a denial, or after the first sign-in */
|
|
106
|
+
fullName: IAppleAuthenticationFullName | null;
|
|
107
|
+
/** Obscured with an Apple domain when the user withholds the address */
|
|
108
|
+
email: string | null;
|
|
109
|
+
realUserStatus: AppleAuthenticationUserDetectionStatus;
|
|
110
|
+
/** A JSON Web Token with information about the user */
|
|
111
|
+
identityToken: string | null;
|
|
112
|
+
/** A short-lived session token for the app's server, it changes every session */
|
|
113
|
+
authorizationCode: string | null;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** What the native module accepts: the options of a call plus the operation it performs */
|
|
117
|
+
export type IAppleAuthenticationRequest = (
|
|
118
|
+
| IAppleAuthenticationSignInOptions
|
|
119
|
+
| IAppleAuthenticationRefreshOptions
|
|
120
|
+
| IAppleAuthenticationSignOutOptions
|
|
121
|
+
) & { requestedOperation: AppleAuthenticationOperation };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import { descriptorToReact } from '@symbiote-native/react';
|
|
3
|
+
import { renderAppleAuthenticationButton } from '../core/apple-authentication-button';
|
|
4
|
+
import type { IAppleAuthenticationButtonProps } from '../core/apple-authentication-button';
|
|
5
|
+
|
|
6
|
+
/** React twin of `expo-apple-authentication`'s `AppleAuthenticationButton`, iOS only */
|
|
7
|
+
export function AppleAuthenticationButton(
|
|
8
|
+
props: IAppleAuthenticationButtonProps & { className?: string },
|
|
9
|
+
): ReactElement | null {
|
|
10
|
+
const descriptor = renderAppleAuthenticationButton(props);
|
|
11
|
+
return descriptor ? descriptorToReact(descriptor) : null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @symbiote-native/apple-authentication/react: кнопка и поток входа на общем ядре
|
|
2
|
+
|
|
3
|
+
export { AppleAuthenticationButton } from './apple-authentication-button';
|
|
4
|
+
export type { IAppleAuthenticationButtonProps } from '../core';
|
|
5
|
+
export {
|
|
6
|
+
APPLE_AUTHENTICATION_MODULE_NAME,
|
|
7
|
+
AppleAuthenticationButtonStyle,
|
|
8
|
+
AppleAuthenticationButtonType,
|
|
9
|
+
AppleAuthenticationCredentialState,
|
|
10
|
+
AppleAuthenticationOperation,
|
|
11
|
+
AppleAuthenticationScope,
|
|
12
|
+
AppleAuthenticationUserDetectionStatus,
|
|
13
|
+
addRevokeListener,
|
|
14
|
+
appleAuthenticationButtonViewName,
|
|
15
|
+
formatFullName,
|
|
16
|
+
getCredentialStateAsync,
|
|
17
|
+
isAvailableAsync,
|
|
18
|
+
refreshAsync,
|
|
19
|
+
signInAsync,
|
|
20
|
+
signOutAsync,
|
|
21
|
+
type EventSubscription,
|
|
22
|
+
type IAppleAuthenticationCredential,
|
|
23
|
+
type IAppleAuthenticationFullName,
|
|
24
|
+
type IAppleAuthenticationFullNameFormatStyle,
|
|
25
|
+
type IAppleAuthenticationRefreshOptions,
|
|
26
|
+
type IAppleAuthenticationSignInOptions,
|
|
27
|
+
type IAppleAuthenticationSignOutOptions,
|
|
28
|
+
} from '../core';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineOptionalDescriptorComponent } from '@symbiote-native/solid';
|
|
2
|
+
import { renderAppleAuthenticationButton } from '../core/apple-authentication-button';
|
|
3
|
+
import type { IAppleAuthenticationButtonProps } from '../core/apple-authentication-button';
|
|
4
|
+
|
|
5
|
+
/** Solid twin of `expo-apple-authentication`'s `AppleAuthenticationButton`, iOS only */
|
|
6
|
+
export const AppleAuthenticationButton =
|
|
7
|
+
defineOptionalDescriptorComponent<IAppleAuthenticationButtonProps>(
|
|
8
|
+
renderAppleAuthenticationButton,
|
|
9
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @symbiote-native/apple-authentication/solid: кнопка и поток входа на общем ядре
|
|
2
|
+
|
|
3
|
+
export { AppleAuthenticationButton } from './apple-authentication-button';
|
|
4
|
+
export type { IAppleAuthenticationButtonProps } from '../core';
|
|
5
|
+
export {
|
|
6
|
+
APPLE_AUTHENTICATION_MODULE_NAME,
|
|
7
|
+
AppleAuthenticationButtonStyle,
|
|
8
|
+
AppleAuthenticationButtonType,
|
|
9
|
+
AppleAuthenticationCredentialState,
|
|
10
|
+
AppleAuthenticationOperation,
|
|
11
|
+
AppleAuthenticationScope,
|
|
12
|
+
AppleAuthenticationUserDetectionStatus,
|
|
13
|
+
addRevokeListener,
|
|
14
|
+
appleAuthenticationButtonViewName,
|
|
15
|
+
formatFullName,
|
|
16
|
+
getCredentialStateAsync,
|
|
17
|
+
isAvailableAsync,
|
|
18
|
+
refreshAsync,
|
|
19
|
+
signInAsync,
|
|
20
|
+
signOutAsync,
|
|
21
|
+
type EventSubscription,
|
|
22
|
+
type IAppleAuthenticationCredential,
|
|
23
|
+
type IAppleAuthenticationFullName,
|
|
24
|
+
type IAppleAuthenticationFullNameFormatStyle,
|
|
25
|
+
type IAppleAuthenticationRefreshOptions,
|
|
26
|
+
type IAppleAuthenticationSignInOptions,
|
|
27
|
+
type IAppleAuthenticationSignOutOptions,
|
|
28
|
+
} from '../core';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// The native view name is mixed-case, which a literal tag would parse as a component reference,
|
|
3
|
+
// so the tag is dynamic
|
|
4
|
+
import { hostProps } from '@symbiote-native/svelte/native-view-bridge';
|
|
5
|
+
import { renderAppleAuthenticationButton } from '../core/apple-authentication-button';
|
|
6
|
+
import type { IAppleAuthenticationButtonProps } from '../core/apple-authentication-button';
|
|
7
|
+
|
|
8
|
+
const props: IAppleAuthenticationButtonProps = $props();
|
|
9
|
+
const descriptor = $derived(renderAppleAuthenticationButton({ ...props }));
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
{#if descriptor}
|
|
13
|
+
<svelte:element
|
|
14
|
+
this={descriptor.type}
|
|
15
|
+
{@attach hostProps(descriptor.props)}
|
|
16
|
+
/>
|
|
17
|
+
{/if}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineComponent, type VNode } from '@vue/runtime-core';
|
|
2
|
+
import { descriptorToVue, normalizeVueAttrs } from '@symbiote-native/vue';
|
|
3
|
+
import { renderAppleAuthenticationButton } from '../core/apple-authentication-button';
|
|
4
|
+
|
|
5
|
+
/** Vue twin of `expo-apple-authentication`'s `AppleAuthenticationButton`, iOS only */
|
|
6
|
+
export const AppleAuthenticationButton = defineComponent({
|
|
7
|
+
name: 'AppleAuthenticationButton',
|
|
8
|
+
// Все атрибуты это пропсы нативного view, на обёртку ничего не должно просочиться
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
setup(_props, { attrs }) {
|
|
11
|
+
return (): VNode | null => {
|
|
12
|
+
const descriptor = renderAppleAuthenticationButton(
|
|
13
|
+
normalizeVueAttrs(attrs),
|
|
14
|
+
);
|
|
15
|
+
return descriptor ? descriptorToVue(descriptor) : null;
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
});
|
package/src/vue/index.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// @symbiote-native/apple-authentication/vue: кнопка и поток входа на общем ядре
|
|
2
|
+
|
|
3
|
+
export { AppleAuthenticationButton } from './apple-authentication-button';
|
|
4
|
+
export type { IAppleAuthenticationButtonProps } from '../core';
|
|
5
|
+
export {
|
|
6
|
+
APPLE_AUTHENTICATION_MODULE_NAME,
|
|
7
|
+
AppleAuthenticationButtonStyle,
|
|
8
|
+
AppleAuthenticationButtonType,
|
|
9
|
+
AppleAuthenticationCredentialState,
|
|
10
|
+
AppleAuthenticationOperation,
|
|
11
|
+
AppleAuthenticationScope,
|
|
12
|
+
AppleAuthenticationUserDetectionStatus,
|
|
13
|
+
addRevokeListener,
|
|
14
|
+
appleAuthenticationButtonViewName,
|
|
15
|
+
formatFullName,
|
|
16
|
+
getCredentialStateAsync,
|
|
17
|
+
isAvailableAsync,
|
|
18
|
+
refreshAsync,
|
|
19
|
+
signInAsync,
|
|
20
|
+
signOutAsync,
|
|
21
|
+
type EventSubscription,
|
|
22
|
+
type IAppleAuthenticationCredential,
|
|
23
|
+
type IAppleAuthenticationFullName,
|
|
24
|
+
type IAppleAuthenticationFullNameFormatStyle,
|
|
25
|
+
type IAppleAuthenticationRefreshOptions,
|
|
26
|
+
type IAppleAuthenticationSignInOptions,
|
|
27
|
+
type IAppleAuthenticationSignOutOptions,
|
|
28
|
+
} from '../core';
|