react-native-authsignal 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/.editorconfig +15 -0
- package/.gitattributes +3 -0
- package/.github/workflows/release-package.yml +39 -0
- package/.gitignore +67 -0
- package/.watchmanconfig +1 -0
- package/LICENSE +20 -0
- package/README.md +23 -0
- package/android/build.gradle +147 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +6 -0
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -0
- package/android/src/main/AndroidManifest.xml +37 -0
- package/android/src/main/java/com/authsignal/react/AuthenticationActivity.java +73 -0
- package/android/src/main/java/com/authsignal/react/AuthsignalModule.java +118 -0
- package/android/src/main/java/com/authsignal/react/AuthsignalPackage.java +22 -0
- package/android/src/main/java/com/authsignal/react/RedirectActivity.java +18 -0
- package/babel.config.js +3 -0
- package/ios/Authsignal.h +12 -0
- package/ios/Authsignal.m +68 -0
- package/ios/Authsignal.xcodeproj/project.pbxproj +274 -0
- package/lib/commonjs/index.js +39 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +33 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/index.d.ts +2 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +114 -0
- package/react-native-authsignal.podspec +35 -0
- package/src/index.tsx +42 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +28 -0
- package/yarn.lock +6042 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package 'react-native-authsignal' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
|
|
6
|
+
const Authsignal = NativeModules.Authsignal ? NativeModules.Authsignal : new Proxy({}, {
|
|
7
|
+
get() {
|
|
8
|
+
throw new Error(LINKING_ERROR);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export function launch(url) {
|
|
12
|
+
if (Platform.OS === 'ios') {
|
|
13
|
+
return Authsignal.launch(url);
|
|
14
|
+
} else {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const callback = (error, token) => {
|
|
17
|
+
if (token) {
|
|
18
|
+
resolve(token);
|
|
19
|
+
} else if (error) {
|
|
20
|
+
if (error.error === 'user_cancelled') {
|
|
21
|
+
resolve(null);
|
|
22
|
+
} else {
|
|
23
|
+
reject(error);
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
reject('Unexpected error');
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
Authsignal.launch(url, callback);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Authsignal","Proxy","get","Error","launch","url","OS","Promise","resolve","reject","callback","error","token"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GAChB,kFAAiF,GAClFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,UAAU,GAAGN,aAAa,CAACM,UAAU,GACvCN,aAAa,CAACM,UAAU,GACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CAAC,CACF;AAEL,OAAO,SAASQ,MAAM,CAACC,GAAW,EAA0B;EAC1D,IAAIV,QAAQ,CAACW,EAAE,KAAK,KAAK,EAAE;IACzB,OAAON,UAAU,CAACI,MAAM,CAACC,GAAG,CAAC;EAC/B,CAAC,MAAM;IACL,OAAO,IAAIE,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtC,MAAMC,QAAQ,GAAG,CAACC,KAAU,EAAEC,KAAa,KAAK;QAC9C,IAAIA,KAAK,EAAE;UACTJ,OAAO,CAACI,KAAK,CAAC;QAChB,CAAC,MAAM,IAAID,KAAK,EAAE;UAChB,IAAIA,KAAK,CAACA,KAAK,KAAK,gBAAgB,EAAE;YACpCH,OAAO,CAAC,IAAI,CAAC;UACf,CAAC,MAAM;YACLC,MAAM,CAACE,KAAK,CAAC;UACf;QACF,CAAC,MAAM;UACLF,MAAM,CAAC,kBAAkB,CAAC;QAC5B;MACF,CAAC;MAEDT,UAAU,CAACI,MAAM,CAACC,GAAG,EAAEK,QAAQ,CAAC;IAClC,CAAC,CAAC;EACJ;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAsB1D"}
|
package/package.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-authsignal",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "test",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/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
|
+
"!lib/typescript/example",
|
|
18
|
+
"!ios/build",
|
|
19
|
+
"!android/build",
|
|
20
|
+
"!android/gradle",
|
|
21
|
+
"!android/gradlew",
|
|
22
|
+
"!android/gradlew.bat",
|
|
23
|
+
"!android/local.properties",
|
|
24
|
+
"!**/__tests__",
|
|
25
|
+
"!**/__fixtures__",
|
|
26
|
+
"!**/__mocks__",
|
|
27
|
+
"!**/.*"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"typescript": "tsc --noEmit",
|
|
31
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
32
|
+
"prepare": "bob build"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"react-native",
|
|
36
|
+
"ios",
|
|
37
|
+
"android"
|
|
38
|
+
],
|
|
39
|
+
"repository": "https://github.com/authsignal/react-native-authsignal.git",
|
|
40
|
+
"author": "Authsignal <chris@authsignal.com> (https://www.authsignal.com)",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/authsignal/react-native-authsignal.git/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/authsignal/react-native-authsignal.git#readme",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"registry": "https://registry.npmjs.org/"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@react-native-community/eslint-config": "^3.0.2",
|
|
51
|
+
"@types/react": "~17.0.21",
|
|
52
|
+
"@types/react-native": "0.68.0",
|
|
53
|
+
"eslint": "^8.4.1",
|
|
54
|
+
"eslint-config-prettier": "^8.5.0",
|
|
55
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
56
|
+
"pod-install": "^0.1.0",
|
|
57
|
+
"prettier": "^2.0.5",
|
|
58
|
+
"react": "18.1.0",
|
|
59
|
+
"react-native": "0.70.4",
|
|
60
|
+
"react-native-builder-bob": "^0.20.0",
|
|
61
|
+
"typescript": "^4.5.2"
|
|
62
|
+
},
|
|
63
|
+
"resolutions": {
|
|
64
|
+
"@types/react": "17.0.21"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"react": "*",
|
|
68
|
+
"react-native": "*"
|
|
69
|
+
},
|
|
70
|
+
"eslintConfig": {
|
|
71
|
+
"root": true,
|
|
72
|
+
"extends": [
|
|
73
|
+
"@react-native-community",
|
|
74
|
+
"prettier"
|
|
75
|
+
],
|
|
76
|
+
"rules": {
|
|
77
|
+
"prettier/prettier": [
|
|
78
|
+
"error",
|
|
79
|
+
{
|
|
80
|
+
"quoteProps": "consistent",
|
|
81
|
+
"singleQuote": true,
|
|
82
|
+
"tabWidth": 2,
|
|
83
|
+
"trailingComma": "es5",
|
|
84
|
+
"useTabs": false
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"eslintIgnore": [
|
|
90
|
+
"node_modules/",
|
|
91
|
+
"lib/"
|
|
92
|
+
],
|
|
93
|
+
"prettier": {
|
|
94
|
+
"quoteProps": "consistent",
|
|
95
|
+
"singleQuote": true,
|
|
96
|
+
"tabWidth": 2,
|
|
97
|
+
"trailingComma": "es5",
|
|
98
|
+
"useTabs": false
|
|
99
|
+
},
|
|
100
|
+
"react-native-builder-bob": {
|
|
101
|
+
"source": "src",
|
|
102
|
+
"output": "lib",
|
|
103
|
+
"targets": [
|
|
104
|
+
"commonjs",
|
|
105
|
+
"module",
|
|
106
|
+
[
|
|
107
|
+
"typescript",
|
|
108
|
+
{
|
|
109
|
+
"project": "tsconfig.build.json"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "react-native-authsignal"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => "10.0" }
|
|
15
|
+
s.source = { :git => "https://github.com/authsignal/react-native-authsignal.git.git", :tag => "#{s.version}" }
|
|
16
|
+
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
+
|
|
19
|
+
s.dependency "React-Core"
|
|
20
|
+
|
|
21
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
22
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
23
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
24
|
+
s.pod_target_xcconfig = {
|
|
25
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
26
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
s.dependency "React-Codegen"
|
|
30
|
+
s.dependency "RCT-Folly"
|
|
31
|
+
s.dependency "RCTRequired"
|
|
32
|
+
s.dependency "RCTTypeSafety"
|
|
33
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
34
|
+
end
|
|
35
|
+
end
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package 'react-native-authsignal' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo Go\n';
|
|
8
|
+
|
|
9
|
+
const Authsignal = NativeModules.Authsignal
|
|
10
|
+
? NativeModules.Authsignal
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export function launch(url: string): Promise<string | null> {
|
|
21
|
+
if (Platform.OS === 'ios') {
|
|
22
|
+
return Authsignal.launch(url);
|
|
23
|
+
} else {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
const callback = (error: any, token: string) => {
|
|
26
|
+
if (token) {
|
|
27
|
+
resolve(token);
|
|
28
|
+
} else if (error) {
|
|
29
|
+
if (error.error === 'user_cancelled') {
|
|
30
|
+
resolve(null);
|
|
31
|
+
} else {
|
|
32
|
+
reject(error);
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
reject('Unexpected error');
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
Authsignal.launch(url, callback);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": "./",
|
|
4
|
+
"paths": {
|
|
5
|
+
"react-native-authsignal": ["./src/index"]
|
|
6
|
+
},
|
|
7
|
+
"allowUnreachableCode": false,
|
|
8
|
+
"allowUnusedLabels": false,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"importsNotUsedAsValues": "error",
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"jsx": "react",
|
|
13
|
+
"lib": ["esnext"],
|
|
14
|
+
"module": "esnext",
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"noFallthroughCasesInSwitch": true,
|
|
17
|
+
"noImplicitReturns": true,
|
|
18
|
+
"noImplicitUseStrict": false,
|
|
19
|
+
"noStrictGenericChecks": false,
|
|
20
|
+
"noUncheckedIndexedAccess": true,
|
|
21
|
+
"noUnusedLocals": true,
|
|
22
|
+
"noUnusedParameters": true,
|
|
23
|
+
"resolveJsonModule": true,
|
|
24
|
+
"skipLibCheck": true,
|
|
25
|
+
"strict": true,
|
|
26
|
+
"target": "esnext"
|
|
27
|
+
}
|
|
28
|
+
}
|