@react-native-kakao/cert 0.0.0-stage → 3.2.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/CHANGELOG.md +90 -0
- package/LICENSE +20 -0
- package/README.md +6 -2
- package/RNCKakaoCert.podspec +25 -0
- package/android/build.gradle +43 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/net/mjstudio/rnkakao/cert/RNCKakaoCertModule.kt +292 -0
- package/android/src/main/java/net/mjstudio/rnkakao/cert/RNCKakaoCertPackage.kt +34 -0
- package/ios/RNCKakaoCert.h +4 -0
- package/ios/RNCKakaoCert.mm +80 -0
- package/ios/RNCKakaoCertManager.swift +327 -0
- package/ios/RNCKakaoCertUtil.h +8 -0
- package/ios/RNCKakaoCertUtil.mm +17 -0
- package/lib/commonjs/index.js +126 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/index.web.js +73 -0
- package/lib/commonjs/index.web.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/spec/NativeKakaoCert.ts +30 -0
- package/lib/module/index.js +108 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/index.web.js +56 -0
- package/lib/module/index.web.js.map +1 -0
- package/lib/module/spec/NativeKakaoCert.ts +30 -0
- package/lib/typescript/src/index.d.ts +127 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/spec/NativeKakaoCert.d.ts +20 -0
- package/lib/typescript/src/spec/NativeKakaoCert.d.ts.map +1 -0
- package/package.json +96 -3
- package/src/index.ts +196 -0
- package/src/index.web.ts +64 -0
- package/src/spec/NativeKakaoCert.ts +30 -0
package/src/index.web.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { filterNonNullishKeys } from '@mj-studio/js-util';
|
|
2
|
+
import { kCreateWebError, kRunWebAPI } from '@react-native-kakao/core';
|
|
3
|
+
|
|
4
|
+
import type { KakaoCertAPI } from './index';
|
|
5
|
+
|
|
6
|
+
declare const Kakao: { Auth: { authorizeForCert: (options: object) => void } };
|
|
7
|
+
|
|
8
|
+
const unsupportedPlatformErrorCode = 'Package-UnsupportedPlatform';
|
|
9
|
+
|
|
10
|
+
async function unsupported(): Promise<never> {
|
|
11
|
+
kCreateWebError({
|
|
12
|
+
code: unsupportedPlatformErrorCode,
|
|
13
|
+
message: 'This certification operation requires the Android or iOS Cert SDK.',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const KakaoCert: KakaoCertAPI = {
|
|
18
|
+
certLoginWithKakaoTalk: unsupported,
|
|
19
|
+
certLoginWithKakaoAccount: unsupported,
|
|
20
|
+
issueCertTokenWithCode: async () => {
|
|
21
|
+
kCreateWebError({
|
|
22
|
+
code: unsupportedPlatformErrorCode,
|
|
23
|
+
message: 'issueCertTokenWithCode is only available on iOS.',
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
getPublicKey: unsupported,
|
|
27
|
+
getSessionInfo: unsupported,
|
|
28
|
+
fetchSessionInfo: unsupported,
|
|
29
|
+
fetchSessionInfoByAppKey: unsupported,
|
|
30
|
+
isValidSession: unsupported,
|
|
31
|
+
deleteKeyPair: unsupported,
|
|
32
|
+
reducedSign: unsupported,
|
|
33
|
+
isKakaoTalkSignAvailable: async () => false,
|
|
34
|
+
signWithKakaoTalk: unsupported,
|
|
35
|
+
authorizeForCertWeb: (options) =>
|
|
36
|
+
kRunWebAPI(() => {
|
|
37
|
+
Kakao.Auth.authorizeForCert(
|
|
38
|
+
filterNonNullishKeys({
|
|
39
|
+
...options,
|
|
40
|
+
prompt: options.prompt?.join(','),
|
|
41
|
+
scope: options.scope?.join(','),
|
|
42
|
+
serviceTerms: options.serviceTerms?.join(','),
|
|
43
|
+
identifyItems: options.identifyItems?.join(','),
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const {
|
|
50
|
+
certLoginWithKakaoTalk,
|
|
51
|
+
certLoginWithKakaoAccount,
|
|
52
|
+
issueCertTokenWithCode,
|
|
53
|
+
getPublicKey,
|
|
54
|
+
getSessionInfo,
|
|
55
|
+
fetchSessionInfo,
|
|
56
|
+
fetchSessionInfoByAppKey,
|
|
57
|
+
isValidSession,
|
|
58
|
+
deleteKeyPair,
|
|
59
|
+
reducedSign,
|
|
60
|
+
isKakaoTalkSignAvailable,
|
|
61
|
+
signWithKakaoTalk,
|
|
62
|
+
authorizeForCertWeb,
|
|
63
|
+
} = KakaoCert;
|
|
64
|
+
export default KakaoCert;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TurboModule } from 'react-native';
|
|
2
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
3
|
+
import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
import type { KakaoCertSessionInfo, KakaoCertSignStatusInfo, KakaoCertTokenInfo } from '..';
|
|
6
|
+
|
|
7
|
+
export interface Spec extends TurboModule {
|
|
8
|
+
certLoginWithKakaoTalk(options: UnsafeObject): Promise<KakaoCertTokenInfo>;
|
|
9
|
+
certLoginWithKakaoAccount(options: UnsafeObject): Promise<KakaoCertTokenInfo>;
|
|
10
|
+
issueCertTokenWithCode(
|
|
11
|
+
code: string,
|
|
12
|
+
codeVerifier?: string,
|
|
13
|
+
redirectUri?: string,
|
|
14
|
+
): Promise<KakaoCertTokenInfo>;
|
|
15
|
+
publicKey(certType: string): Promise<string | null>;
|
|
16
|
+
sessionInfo(certType: string): Promise<KakaoCertSessionInfo | null>;
|
|
17
|
+
fetchSessionInfo(certType: string, txId: string): Promise<KakaoCertSessionInfo>;
|
|
18
|
+
fetchSessionInfoByAppKey(
|
|
19
|
+
certType: string,
|
|
20
|
+
txId: string,
|
|
21
|
+
targetAppKey?: string,
|
|
22
|
+
): Promise<KakaoCertSessionInfo>;
|
|
23
|
+
isValidSession(certType: string): Promise<boolean>;
|
|
24
|
+
deleteKeyPair(certType: string): Promise<void>;
|
|
25
|
+
reducedSign(certType: string, data: string): Promise<string>;
|
|
26
|
+
isKakaoTalkSignAvailable(): Promise<boolean>;
|
|
27
|
+
signWithKakaoTalk(txId: string, targetAppKey?: string): Promise<KakaoCertSignStatusInfo>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('RNCKakaoCert');
|