@react-native-kakao/cert 0.0.0-stage → 3.1.0-next.2

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.
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+
3
+ import { kAssert, kCreateWebError } from '@react-native-kakao/core';
4
+ import Native from './spec/NativeKakaoCert';
5
+ const signerInformationItems = ['ci', 'name', 'birthday', 'phone_number'];
6
+ const certificationPrompts = ['Login', 'Create', 'SelectAccount'];
7
+ const accountCertType = 'K2100';
8
+ const minActivityRequestCode = -2147483648;
9
+ const maxActivityRequestCode = 2147483647;
10
+ export async function certLoginWithKakaoTalk(options) {
11
+ validateLoginRequest(options);
12
+ const requestCode = options.android?.requestCode;
13
+ kAssert(requestCode == null || Number.isInteger(requestCode) && requestCode >= minActivityRequestCode && requestCode <= maxActivityRequestCode, `[certLoginWithKakaoTalk] requestCode must be an integer from ${minActivityRequestCode} to ${maxActivityRequestCode}`);
14
+ return Native.certLoginWithKakaoTalk(options);
15
+ }
16
+ export async function certLoginWithKakaoAccount(options) {
17
+ kAssert(options.certType === accountCertType, '[certLoginWithKakaoAccount] certType must be K2100');
18
+ validateLoginRequest(options);
19
+ return Native.certLoginWithKakaoAccount(options);
20
+ }
21
+ export async function issueCertTokenWithCode({
22
+ code,
23
+ codeVerifier,
24
+ redirectUri
25
+ }) {
26
+ kAssert(typeof code === 'string' && code.length > 0, '[issueCertTokenWithCode] code is required');
27
+ return Native.issueCertTokenWithCode(code, codeVerifier, redirectUri);
28
+ }
29
+ export async function getPublicKey({
30
+ certType
31
+ }) {
32
+ return (await Native.publicKey(certType)) ?? undefined;
33
+ }
34
+ export async function getSessionInfo({
35
+ certType
36
+ }) {
37
+ return (await Native.sessionInfo(certType)) ?? undefined;
38
+ }
39
+ export function fetchSessionInfo({
40
+ certType,
41
+ txId
42
+ }) {
43
+ return Native.fetchSessionInfo(certType, txId);
44
+ }
45
+ export function fetchSessionInfoByAppKey({
46
+ certType,
47
+ txId,
48
+ targetAppKey
49
+ }) {
50
+ return Native.fetchSessionInfoByAppKey(certType, txId, targetAppKey);
51
+ }
52
+ export function isValidSession({
53
+ certType
54
+ }) {
55
+ return Native.isValidSession(certType);
56
+ }
57
+ export async function deleteKeyPair({
58
+ certType
59
+ }) {
60
+ await Native.deleteKeyPair(certType);
61
+ }
62
+ export function reducedSign({
63
+ certType,
64
+ data
65
+ }) {
66
+ return Native.reducedSign(certType, data);
67
+ }
68
+ export function isKakaoTalkSignAvailable() {
69
+ return Native.isKakaoTalkSignAvailable();
70
+ }
71
+ export function signWithKakaoTalk({
72
+ txId,
73
+ targetAppKey
74
+ }) {
75
+ return Native.signWithKakaoTalk(txId, targetAppKey);
76
+ }
77
+ export async function authorizeForCertWeb(_options) {
78
+ kCreateWebError({
79
+ code: 'Package-UnsupportedPlatform',
80
+ message: 'authorizeForCertWeb is available on web only.'
81
+ });
82
+ }
83
+ function validateLoginRequest(options) {
84
+ kAssert(options.prompts?.every(prompt => certificationPrompts.includes(prompt)) ?? true, '[cert login] unsupported prompt');
85
+ kAssert(options.identifyItems?.every(item => signerInformationItems.includes(item)) ?? true, '[cert login] unsupported signer information');
86
+ if (options.certType === accountCertType) {
87
+ kAssert(!!options.settleId && !!options.signData, '[cert login] settleId and signData are required');
88
+ } else {
89
+ kAssert(options.certType === 'K2220' && !!options.txId, '[cert login] K2220 requires txId');
90
+ }
91
+ }
92
+ const KakaoCert = {
93
+ certLoginWithKakaoTalk,
94
+ certLoginWithKakaoAccount,
95
+ issueCertTokenWithCode,
96
+ getPublicKey,
97
+ getSessionInfo,
98
+ fetchSessionInfo,
99
+ fetchSessionInfoByAppKey,
100
+ isValidSession,
101
+ deleteKeyPair,
102
+ reducedSign,
103
+ isKakaoTalkSignAvailable,
104
+ signWithKakaoTalk,
105
+ authorizeForCertWeb
106
+ };
107
+ export default KakaoCert;
108
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["kAssert","kCreateWebError","Native","signerInformationItems","certificationPrompts","accountCertType","minActivityRequestCode","maxActivityRequestCode","certLoginWithKakaoTalk","options","validateLoginRequest","requestCode","android","Number","isInteger","certLoginWithKakaoAccount","certType","issueCertTokenWithCode","code","codeVerifier","redirectUri","length","getPublicKey","publicKey","undefined","getSessionInfo","sessionInfo","fetchSessionInfo","txId","fetchSessionInfoByAppKey","targetAppKey","isValidSession","deleteKeyPair","reducedSign","data","isKakaoTalkSignAvailable","signWithKakaoTalk","authorizeForCertWeb","_options","message","prompts","every","prompt","includes","identifyItems","item","settleId","signData","KakaoCert"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,OAAO,EAAEC,eAAe,QAAQ,0BAA0B;AAGnE,OAAOC,MAAM,MAAM,wBAAwB;AAI3C,MAAMC,sBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,CAAU;AAClF,MAAMC,oBAAoB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAU;AAC1E,MAAMC,eAAe,GAAG,OAAO;AA4D/B,MAAMC,sBAAsB,GAAG,CAAC,UAAU;AAC1C,MAAMC,sBAAsB,GAAG,UAAU;AAEzC,OAAO,eAAeC,sBAAsBA,CAACC,OAAkC,EAAE;EAC/EC,oBAAoB,CAACD,OAAO,CAAC;EAE7B,MAAME,WAAW,GAAGF,OAAO,CAACG,OAAO,EAAED,WAAW;EAChDX,OAAO,CACLW,WAAW,IAAI,IAAI,IAChBE,MAAM,CAACC,SAAS,CAACH,WAAW,CAAC,IAC5BA,WAAW,IAAIL,sBAAsB,IACrCK,WAAW,IAAIJ,sBAAuB,EAC1C,gEAAgED,sBAAsB,OAAOC,sBAAsB,EACrH,CAAC;EAED,OAAOL,MAAM,CAACM,sBAAsB,CAACC,OAAO,CAAC;AAC/C;AAEA,OAAO,eAAeM,yBAAyBA,CAACN,OAAqC,EAAE;EACrFT,OAAO,CACLS,OAAO,CAACO,QAAQ,KAAKX,eAAe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,yBAAyB;EACzBE,sBAAsB;EACtBK,YAAY;EACZG,cAAc;EACdE,gBAAgB;EAChBE,wBAAwB;EACxBE,cAAc;EACdC,aAAa;EACbC,WAAW;EACXE,wBAAwB;EACxBC,iBAAiB;EACjBC;AACF,CAAC;AACD,eAAeW,SAAS","ignoreList":[]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ import { filterNonNullishKeys } from '@mj-studio/js-util';
4
+ import { kCreateWebError, kRunWebAPI } from '@react-native-kakao/core';
5
+ const unsupportedPlatformErrorCode = 'Package-UnsupportedPlatform';
6
+ async function unsupported() {
7
+ kCreateWebError({
8
+ code: unsupportedPlatformErrorCode,
9
+ message: 'This certification operation requires the Android or iOS Cert SDK.'
10
+ });
11
+ }
12
+ const KakaoCert = {
13
+ certLoginWithKakaoTalk: unsupported,
14
+ certLoginWithKakaoAccount: unsupported,
15
+ issueCertTokenWithCode: async () => {
16
+ kCreateWebError({
17
+ code: unsupportedPlatformErrorCode,
18
+ message: 'issueCertTokenWithCode is only available on iOS.'
19
+ });
20
+ },
21
+ getPublicKey: unsupported,
22
+ getSessionInfo: unsupported,
23
+ fetchSessionInfo: unsupported,
24
+ fetchSessionInfoByAppKey: unsupported,
25
+ isValidSession: unsupported,
26
+ deleteKeyPair: unsupported,
27
+ reducedSign: unsupported,
28
+ isKakaoTalkSignAvailable: async () => false,
29
+ signWithKakaoTalk: unsupported,
30
+ authorizeForCertWeb: options => kRunWebAPI(() => {
31
+ Kakao.Auth.authorizeForCert(filterNonNullishKeys({
32
+ ...options,
33
+ prompt: options.prompt?.join(','),
34
+ scope: options.scope?.join(','),
35
+ serviceTerms: options.serviceTerms?.join(','),
36
+ identifyItems: options.identifyItems?.join(',')
37
+ }));
38
+ })
39
+ };
40
+ export const {
41
+ certLoginWithKakaoTalk,
42
+ certLoginWithKakaoAccount,
43
+ issueCertTokenWithCode,
44
+ getPublicKey,
45
+ getSessionInfo,
46
+ fetchSessionInfo,
47
+ fetchSessionInfoByAppKey,
48
+ isValidSession,
49
+ deleteKeyPair,
50
+ reducedSign,
51
+ isKakaoTalkSignAvailable,
52
+ signWithKakaoTalk,
53
+ authorizeForCertWeb
54
+ } = KakaoCert;
55
+ export default KakaoCert;
56
+ //# sourceMappingURL=index.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["filterNonNullishKeys","kCreateWebError","kRunWebAPI","unsupportedPlatformErrorCode","unsupported","code","message","KakaoCert","certLoginWithKakaoTalk","certLoginWithKakaoAccount","issueCertTokenWithCode","getPublicKey","getSessionInfo","fetchSessionInfo","fetchSessionInfoByAppKey","isValidSession","deleteKeyPair","reducedSign","isKakaoTalkSignAvailable","signWithKakaoTalk","authorizeForCertWeb","options","Kakao","Auth","authorizeForCert","prompt","join","scope","serviceTerms","identifyItems"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":";;AAAA,SAASA,oBAAoB,QAAQ,oBAAoB;AACzD,SAASC,eAAe,EAAEC,UAAU,QAAQ,0BAA0B;AAMtE,MAAMC,4BAA4B,GAAG,6BAA6B;AAElE,eAAeC,WAAWA,CAAA,EAAmB;EAC3CH,eAAe,CAAC;IACdI,IAAI,EAAEF,4BAA4B;IAClCG,OAAO,EAAE;EACX,CAAC,CAAC;AACJ;AAEA,MAAMC,SAAuB,GAAG;EAC9BC,sBAAsB,EAAEJ,WAAW;EACnCK,yBAAyB,EAAEL,WAAW;EACtCM,sBAAsB,EAAE,MAAAA,CAAA,KAAY;IAClCT,eAAe,CAAC;MACdI,IAAI,EAAEF,4BAA4B;MAClCG,OAAO,EAAE;IACX,CAAC,CAAC;EACJ,CAAC;EACDK,YAAY,EAAEP,WAAW;EACzBQ,cAAc,EAAER,WAAW;EAC3BS,gBAAgB,EAAET,WAAW;EAC7BU,wBAAwB,EAAEV,WAAW;EACrCW,cAAc,EAAEX,WAAW;EAC3BY,aAAa,EAAEZ,WAAW;EAC1Ba,WAAW,EAAEb,WAAW;EACxBc,wBAAwB,EAAE,MAAAA,CAAA,KAAY,KAAK;EAC3CC,iBAAiB,EAAEf,WAAW;EAC9BgB,mBAAmB,EAAGC,OAAO,IAC3BnB,UAAU,CAAC,MAAM;IACfoB,KAAK,CAACC,IAAI,CAACC,gBAAgB,CACzBxB,oBAAoB,CAAC;MACnB,GAAGqB,OAAO;MACVI,MAAM,EAAEJ,OAAO,CAACI,MAAM,EAAEC,IAAI,CAAC,GAAG,CAAC;MACjCC,KAAK,EAAEN,OAAO,CAACM,KAAK,EAAED,IAAI,CAAC,GAAG,CAAC;MAC/BE,YAAY,EAAEP,OAAO,CAACO,YAAY,EAAEF,IAAI,CAAC,GAAG,CAAC;MAC7CG,aAAa,EAAER,OAAO,CAACQ,aAAa,EAAEH,IAAI,CAAC,GAAG;IAChD,CAAC,CACH,CAAC;EACH,CAAC;AACL,CAAC;AAED,OAAO,MAAM;EACXlB,sBAAsB;EACtBC,yBAAyB;EACzBC,sBAAsB;EACtBC,YAAY;EACZC,cAAc;EACdC,gBAAgB;EAChBC,wBAAwB;EACxBC,cAAc;EACdC,aAAa;EACbC,WAAW;EACXC,wBAAwB;EACxBC,iBAAiB;EACjBC;AACF,CAAC,GAAGb,SAAS;AACb,eAAeA,SAAS","ignoreList":[]}
@@ -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');
@@ -0,0 +1,127 @@
1
+ import type { KakaoLoginToken } from '@react-native-kakao/user';
2
+ export type KakaoCertType = 'K2100' | 'K2220' | 'K3220';
3
+ export type KakaoCertSessionType = Exclude<KakaoCertType, 'K2100'>;
4
+ declare const signerInformationItems: readonly ["ci", "name", "birthday", "phone_number"];
5
+ declare const certificationPrompts: readonly ["Login", "Create", "SelectAccount"];
6
+ export type KakaoCertIdentifyItem = (typeof signerInformationItems)[number];
7
+ type KakaoCertLoginBase = {
8
+ prompts?: (typeof certificationPrompts)[number][];
9
+ identifyItems?: KakaoCertIdentifyItem[];
10
+ nonce?: string;
11
+ };
12
+ type KakaoCertLoginRequest = {
13
+ certType: 'K2100';
14
+ settleId: string;
15
+ signData: string;
16
+ } | {
17
+ certType: 'K2220';
18
+ txId: string;
19
+ };
20
+ export type KakaoCertTalkLoginOptions = KakaoCertLoginBase & KakaoCertLoginRequest & {
21
+ channelPublicIds?: string[];
22
+ serviceTerms?: string[];
23
+ ios?: {
24
+ launchMethod?: 'UniversalLink' | 'CustomScheme';
25
+ };
26
+ android?: {
27
+ requestCode?: number;
28
+ };
29
+ };
30
+ export type KakaoCertAccountLoginOptions = KakaoCertLoginBase & {
31
+ certType: 'K2100';
32
+ settleId: string;
33
+ signData: string;
34
+ loginHint?: string;
35
+ android?: {
36
+ channelPublicIds?: string[];
37
+ serviceTerms?: string[];
38
+ };
39
+ };
40
+ export type KakaoCertTokenInfo = {
41
+ token: KakaoLoginToken;
42
+ txId: string;
43
+ };
44
+ export type KakaoCertCodeTokenOptions = {
45
+ code: string;
46
+ codeVerifier?: string;
47
+ redirectUri?: string;
48
+ };
49
+ export type KakaoCertSessionInfo = {
50
+ userId?: number | null;
51
+ sessionStartAt: number;
52
+ sessionEndAt: number;
53
+ };
54
+ export type KakaoCertSignStatusInfo = {
55
+ txId: string;
56
+ requestedAt?: number | null;
57
+ requestExpiredAt?: number | null;
58
+ signedAt?: number | null;
59
+ };
60
+ export type KakaoCertWebAuthorizeOptions = {
61
+ redirectUri: string;
62
+ settleId: string;
63
+ signData: string;
64
+ state?: string;
65
+ prompt?: ('login' | 'create' | 'select_account')[];
66
+ scope?: string[];
67
+ throughTalk?: boolean;
68
+ throughSyncplugin?: boolean;
69
+ serviceTerms?: string[];
70
+ channelPublicId?: string;
71
+ deviceType?: 'watch' | 'tv';
72
+ loginHint?: string;
73
+ nonce?: string;
74
+ identifyItems?: KakaoCertIdentifyItem[];
75
+ };
76
+ export declare function certLoginWithKakaoTalk(options: KakaoCertTalkLoginOptions): Promise<KakaoCertTokenInfo>;
77
+ export declare function certLoginWithKakaoAccount(options: KakaoCertAccountLoginOptions): Promise<KakaoCertTokenInfo>;
78
+ export declare function issueCertTokenWithCode({ code, codeVerifier, redirectUri, }: KakaoCertCodeTokenOptions): Promise<KakaoCertTokenInfo>;
79
+ export declare function getPublicKey({ certType }: {
80
+ certType: KakaoCertSessionType;
81
+ }): Promise<string | undefined>;
82
+ export declare function getSessionInfo({ certType }: {
83
+ certType: KakaoCertSessionType;
84
+ }): Promise<KakaoCertSessionInfo | undefined>;
85
+ export declare function fetchSessionInfo({ certType, txId }: {
86
+ certType: 'K2220';
87
+ txId: string;
88
+ }): Promise<KakaoCertSessionInfo>;
89
+ export declare function fetchSessionInfoByAppKey({ certType, txId, targetAppKey, }: {
90
+ certType: 'K3220';
91
+ txId: string;
92
+ targetAppKey?: string;
93
+ }): Promise<KakaoCertSessionInfo>;
94
+ export declare function isValidSession({ certType }: {
95
+ certType: KakaoCertSessionType;
96
+ }): Promise<boolean>;
97
+ export declare function deleteKeyPair({ certType }: {
98
+ certType: KakaoCertSessionType;
99
+ }): Promise<void>;
100
+ export declare function reducedSign({ certType, data }: {
101
+ certType: KakaoCertSessionType;
102
+ data: string;
103
+ }): Promise<string>;
104
+ export declare function isKakaoTalkSignAvailable(): Promise<boolean>;
105
+ export declare function signWithKakaoTalk({ txId, targetAppKey }: {
106
+ txId: string;
107
+ targetAppKey?: string;
108
+ }): Promise<KakaoCertSignStatusInfo>;
109
+ export declare function authorizeForCertWeb(_options: KakaoCertWebAuthorizeOptions): Promise<void>;
110
+ declare const KakaoCert: {
111
+ certLoginWithKakaoTalk: typeof certLoginWithKakaoTalk;
112
+ certLoginWithKakaoAccount: typeof certLoginWithKakaoAccount;
113
+ issueCertTokenWithCode: typeof issueCertTokenWithCode;
114
+ getPublicKey: typeof getPublicKey;
115
+ getSessionInfo: typeof getSessionInfo;
116
+ fetchSessionInfo: typeof fetchSessionInfo;
117
+ fetchSessionInfoByAppKey: typeof fetchSessionInfoByAppKey;
118
+ isValidSession: typeof isValidSession;
119
+ deleteKeyPair: typeof deleteKeyPair;
120
+ reducedSign: typeof reducedSign;
121
+ isKakaoTalkSignAvailable: typeof isKakaoTalkSignAvailable;
122
+ signWithKakaoTalk: typeof signWithKakaoTalk;
123
+ authorizeForCertWeb: typeof authorizeForCertWeb;
124
+ };
125
+ export default KakaoCert;
126
+ export type KakaoCertAPI = typeof KakaoCert;
127
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIhE,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAA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,EAAE,YAAY,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,oCAEhG;AAED,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/F;AAuBD,QAAA,MAAM,SAAS;;;;;;;;;;;;;;CAcd,CAAC;AACF,eAAe,SAAS,CAAC;AACzB,MAAM,MAAM,YAAY,GAAG,OAAO,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import type { KakaoCertSessionInfo, KakaoCertSignStatusInfo, KakaoCertTokenInfo } from '..';
4
+ export interface Spec extends TurboModule {
5
+ certLoginWithKakaoTalk(options: UnsafeObject): Promise<KakaoCertTokenInfo>;
6
+ certLoginWithKakaoAccount(options: UnsafeObject): Promise<KakaoCertTokenInfo>;
7
+ issueCertTokenWithCode(code: string, codeVerifier?: string, redirectUri?: string): Promise<KakaoCertTokenInfo>;
8
+ publicKey(certType: string): Promise<string | null>;
9
+ sessionInfo(certType: string): Promise<KakaoCertSessionInfo | null>;
10
+ fetchSessionInfo(certType: string, txId: string): Promise<KakaoCertSessionInfo>;
11
+ fetchSessionInfoByAppKey(certType: string, txId: string, targetAppKey?: string): Promise<KakaoCertSessionInfo>;
12
+ isValidSession(certType: string): Promise<boolean>;
13
+ deleteKeyPair(certType: string): Promise<void>;
14
+ reducedSign(certType: string, data: string): Promise<string>;
15
+ isKakaoTalkSignAvailable(): Promise<boolean>;
16
+ signWithKakaoTalk(txId: string, targetAppKey?: string): Promise<KakaoCertSignStatusInfo>;
17
+ }
18
+ declare const _default: Spec;
19
+ export default _default;
20
+ //# sourceMappingURL=NativeKakaoCert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeKakaoCert.d.ts","sourceRoot":"","sources":["../../../../src/spec/NativeKakaoCert.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AAC,OAAO,CAAC,CAAC;IAC7C,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC1F;;AAED,wBAAsE"}
package/package.json CHANGED
@@ -1,6 +1,99 @@
1
1
  {
2
2
  "name": "@react-native-kakao/cert",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "React Native Kakao Certification SDK",
4
+ "version": "3.1.0-next.2",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/src/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "cpp",
16
+ "*.podspec",
17
+ "!ios/build",
18
+ "!android/build",
19
+ "!android/gradle",
20
+ "!android/gradlew",
21
+ "!android/gradlew.bat",
22
+ "!android/local.properties",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__",
26
+ "!**/.*"
27
+ ],
28
+ "author": "MJ Studio <mym0404@gmail.com> (https://github.com/mym0404)",
29
+ "homepage": "https://rnkakao.mjstudio.net",
30
+ "scripts": {
31
+ "prepare": "husky",
32
+ "prepack": "bob build && node ../../script/remove-web-declaration-files.ts .",
33
+ "clean": "del-cli android/build lib"
34
+ },
35
+ "keywords": [
36
+ "react-native",
37
+ "kakao",
38
+ "kakao-sdk",
39
+ "typescript",
40
+ "certification",
41
+ "electronic-signature"
42
+ ],
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/mym0404/react-native-kakao.git",
46
+ "directory": "packages/cert"
47
+ },
48
+ "license": "MIT",
49
+ "publishConfig": {
50
+ "registry": "https://registry.npmjs.org/",
51
+ "access": "public"
52
+ },
53
+ "devDependencies": {
54
+ "@react-native-kakao/core": "3.1.0-next.2",
55
+ "@react-native-kakao/user": "3.1.0-next.2",
56
+ "@types/invariant": "^2",
57
+ "@types/react": "~19.2.2",
58
+ "del-cli": "^5.1.0",
59
+ "react": "19.3.0",
60
+ "react-native": "0.88.0",
61
+ "react-native-builder-bob": "0.40.7",
62
+ "typescript": "~6.0.3"
63
+ },
64
+ "peerDependencies": {
65
+ "@react-native-kakao/core": "3.1.0-next.2",
66
+ "@react-native-kakao/user": "3.1.0-next.2",
67
+ "react": "*",
68
+ "react-native": ">=0.76.0"
69
+ },
70
+ "workspaces": [
71
+ "example",
72
+ "packages/*"
73
+ ],
74
+ "react-native-builder-bob": {
75
+ "source": "src",
76
+ "output": "lib",
77
+ "targets": [
78
+ "commonjs",
79
+ "module",
80
+ [
81
+ "typescript",
82
+ {
83
+ "project": "tsconfig.build.json"
84
+ }
85
+ ]
86
+ ]
87
+ },
88
+ "codegenConfig": {
89
+ "name": "RNCKakaoCertSpec",
90
+ "type": "modules",
91
+ "jsSrcsDir": "src",
92
+ "android": {
93
+ "javaPackageName": "net.mjstudio.rnkakao.cert"
94
+ }
95
+ },
96
+ "dependencies": {
97
+ "@mj-studio/js-util": "1.1.14"
98
+ }
6
99
  }
package/src/index.ts ADDED
@@ -0,0 +1,196 @@
1
+ import { kAssert, kCreateWebError } from '@react-native-kakao/core';
2
+ import type { KakaoLoginToken } from '@react-native-kakao/user';
3
+
4
+ import Native from './spec/NativeKakaoCert';
5
+
6
+ export type KakaoCertType = 'K2100' | 'K2220' | 'K3220';
7
+ export type KakaoCertSessionType = Exclude<KakaoCertType, 'K2100'>;
8
+ const signerInformationItems = ['ci', 'name', 'birthday', 'phone_number'] as const;
9
+ const certificationPrompts = ['Login', 'Create', 'SelectAccount'] as const;
10
+ const accountCertType = 'K2100';
11
+
12
+ export type KakaoCertIdentifyItem = (typeof signerInformationItems)[number];
13
+ type KakaoCertLoginBase = {
14
+ prompts?: (typeof certificationPrompts)[number][];
15
+ identifyItems?: KakaoCertIdentifyItem[];
16
+ nonce?: string;
17
+ };
18
+ type KakaoCertLoginRequest =
19
+ | { certType: 'K2100'; settleId: string; signData: string }
20
+ | { certType: 'K2220'; txId: string };
21
+
22
+ export type KakaoCertTalkLoginOptions = KakaoCertLoginBase &
23
+ KakaoCertLoginRequest & {
24
+ channelPublicIds?: string[];
25
+ serviceTerms?: string[];
26
+ ios?: { launchMethod?: 'UniversalLink' | 'CustomScheme' };
27
+ android?: { requestCode?: number };
28
+ };
29
+ export type KakaoCertAccountLoginOptions = KakaoCertLoginBase & {
30
+ certType: 'K2100';
31
+ settleId: string;
32
+ signData: string;
33
+ loginHint?: string;
34
+ android?: { channelPublicIds?: string[]; serviceTerms?: string[] };
35
+ };
36
+ export type KakaoCertTokenInfo = { token: KakaoLoginToken; txId: string };
37
+ export type KakaoCertCodeTokenOptions = {
38
+ code: string;
39
+ codeVerifier?: string;
40
+ redirectUri?: string;
41
+ };
42
+ export type KakaoCertSessionInfo = {
43
+ userId?: number | null;
44
+ sessionStartAt: number;
45
+ sessionEndAt: number;
46
+ };
47
+ export type KakaoCertSignStatusInfo = {
48
+ txId: string;
49
+ requestedAt?: number | null;
50
+ requestExpiredAt?: number | null;
51
+ signedAt?: number | null;
52
+ };
53
+ export type KakaoCertWebAuthorizeOptions = {
54
+ redirectUri: string;
55
+ settleId: string;
56
+ signData: string;
57
+ state?: string;
58
+ prompt?: ('login' | 'create' | 'select_account')[];
59
+ scope?: string[];
60
+ throughTalk?: boolean;
61
+ throughSyncplugin?: boolean;
62
+ serviceTerms?: string[];
63
+ channelPublicId?: string;
64
+ deviceType?: 'watch' | 'tv';
65
+ loginHint?: string;
66
+ nonce?: string;
67
+ identifyItems?: KakaoCertIdentifyItem[];
68
+ };
69
+
70
+ const minActivityRequestCode = -2147483648;
71
+ const maxActivityRequestCode = 2147483647;
72
+
73
+ export async function certLoginWithKakaoTalk(options: KakaoCertTalkLoginOptions) {
74
+ validateLoginRequest(options);
75
+
76
+ const requestCode = options.android?.requestCode;
77
+ kAssert(
78
+ requestCode == null ||
79
+ (Number.isInteger(requestCode) &&
80
+ requestCode >= minActivityRequestCode &&
81
+ requestCode <= maxActivityRequestCode),
82
+ `[certLoginWithKakaoTalk] requestCode must be an integer from ${minActivityRequestCode} to ${maxActivityRequestCode}`,
83
+ );
84
+
85
+ return Native.certLoginWithKakaoTalk(options);
86
+ }
87
+
88
+ export async function certLoginWithKakaoAccount(options: KakaoCertAccountLoginOptions) {
89
+ kAssert(
90
+ options.certType === accountCertType,
91
+ '[certLoginWithKakaoAccount] certType must be K2100',
92
+ );
93
+ validateLoginRequest(options);
94
+
95
+ return Native.certLoginWithKakaoAccount(options);
96
+ }
97
+
98
+ export async function issueCertTokenWithCode({
99
+ code,
100
+ codeVerifier,
101
+ redirectUri,
102
+ }: KakaoCertCodeTokenOptions): Promise<KakaoCertTokenInfo> {
103
+ kAssert(typeof code === 'string' && code.length > 0, '[issueCertTokenWithCode] code is required');
104
+
105
+ return Native.issueCertTokenWithCode(code, codeVerifier, redirectUri);
106
+ }
107
+
108
+ export async function getPublicKey({ certType }: { certType: KakaoCertSessionType }) {
109
+ return (await Native.publicKey(certType)) ?? undefined;
110
+ }
111
+
112
+ export async function getSessionInfo({ certType }: { certType: KakaoCertSessionType }) {
113
+ return (await Native.sessionInfo(certType)) ?? undefined;
114
+ }
115
+
116
+ export function fetchSessionInfo({ certType, txId }: { certType: 'K2220'; txId: string }) {
117
+ return Native.fetchSessionInfo(certType, txId);
118
+ }
119
+
120
+ export function fetchSessionInfoByAppKey({
121
+ certType,
122
+ txId,
123
+ targetAppKey,
124
+ }: {
125
+ certType: 'K3220';
126
+ txId: string;
127
+ targetAppKey?: string;
128
+ }) {
129
+ return Native.fetchSessionInfoByAppKey(certType, txId, targetAppKey);
130
+ }
131
+
132
+ export function isValidSession({ certType }: { certType: KakaoCertSessionType }) {
133
+ return Native.isValidSession(certType);
134
+ }
135
+
136
+ export async function deleteKeyPair({ certType }: { certType: KakaoCertSessionType }) {
137
+ await Native.deleteKeyPair(certType);
138
+ }
139
+
140
+ export function reducedSign({ certType, data }: { certType: KakaoCertSessionType; data: string }) {
141
+ return Native.reducedSign(certType, data);
142
+ }
143
+
144
+ export function isKakaoTalkSignAvailable() {
145
+ return Native.isKakaoTalkSignAvailable();
146
+ }
147
+
148
+ export function signWithKakaoTalk({ txId, targetAppKey }: { txId: string; targetAppKey?: string }) {
149
+ return Native.signWithKakaoTalk(txId, targetAppKey);
150
+ }
151
+
152
+ export async function authorizeForCertWeb(_options: KakaoCertWebAuthorizeOptions): Promise<void> {
153
+ kCreateWebError({
154
+ code: 'Package-UnsupportedPlatform',
155
+ message: 'authorizeForCertWeb is available on web only.',
156
+ });
157
+ }
158
+
159
+ function validateLoginRequest(options: KakaoCertLoginRequest & KakaoCertLoginBase) {
160
+ kAssert(
161
+ options.prompts?.every((prompt) => certificationPrompts.includes(prompt)) ?? true,
162
+ '[cert login] unsupported prompt',
163
+ );
164
+
165
+ kAssert(
166
+ options.identifyItems?.every((item) => signerInformationItems.includes(item)) ?? true,
167
+ '[cert login] unsupported signer information',
168
+ );
169
+
170
+ if (options.certType === accountCertType) {
171
+ kAssert(
172
+ !!options.settleId && !!options.signData,
173
+ '[cert login] settleId and signData are required',
174
+ );
175
+ } else {
176
+ kAssert(options.certType === 'K2220' && !!options.txId, '[cert login] K2220 requires txId');
177
+ }
178
+ }
179
+
180
+ const KakaoCert = {
181
+ certLoginWithKakaoTalk,
182
+ certLoginWithKakaoAccount,
183
+ issueCertTokenWithCode,
184
+ getPublicKey,
185
+ getSessionInfo,
186
+ fetchSessionInfo,
187
+ fetchSessionInfoByAppKey,
188
+ isValidSession,
189
+ deleteKeyPair,
190
+ reducedSign,
191
+ isKakaoTalkSignAvailable,
192
+ signWithKakaoTalk,
193
+ authorizeForCertWeb,
194
+ };
195
+ export default KakaoCert;
196
+ export type KakaoCertAPI = typeof KakaoCert;