@onekeyfe/react-native-pbkdf2 1.1.55

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/Pbkdf2.podspec ADDED
@@ -0,0 +1,19 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "Pbkdf2"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/OneKeyHQ/app-modules/react-native-pbkdf2.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
17
+
18
+ install_modules_dependencies(s)
19
+ end
package/ios/Pbkdf2.h ADDED
@@ -0,0 +1,13 @@
1
+ #import <Pbkdf2Spec/Pbkdf2Spec.h>
2
+
3
+ @interface Pbkdf2 : NativePbkdf2SpecBase <NativePbkdf2Spec>
4
+
5
+ - (void)derive:(NSString *)password
6
+ salt:(NSString *)salt
7
+ rounds:(double)rounds
8
+ keyLength:(double)keyLength
9
+ hash:(NSString *)hash
10
+ resolve:(RCTPromiseResolveBlock)resolve
11
+ reject:(RCTPromiseRejectBlock)reject;
12
+
13
+ @end
package/ios/Pbkdf2.mm ADDED
@@ -0,0 +1,62 @@
1
+ #import "Pbkdf2.h"
2
+ #import <CommonCrypto/CommonKeyDerivation.h>
3
+
4
+ @implementation Pbkdf2
5
+
6
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
7
+ (const facebook::react::ObjCTurboModule::InitParams &)params
8
+ {
9
+ return std::make_shared<facebook::react::NativePbkdf2SpecJSI>(params);
10
+ }
11
+
12
+ + (NSString *)moduleName
13
+ {
14
+ return @"Pbkdf2";
15
+ }
16
+
17
+ + (BOOL)requiresMainQueueSetup
18
+ {
19
+ return NO;
20
+ }
21
+
22
+ // MARK: - derive
23
+
24
+ - (void)derive:(NSString *)password
25
+ salt:(NSString *)salt
26
+ rounds:(double)rounds
27
+ keyLength:(double)keyLength
28
+ hash:(NSString *)hash
29
+ resolve:(RCTPromiseResolveBlock)resolve
30
+ reject:(RCTPromiseRejectBlock)reject
31
+ {
32
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
33
+ @try {
34
+ NSData *passwordData = [[NSData alloc] initWithBase64EncodedString:password options:0];
35
+ NSData *saltData = [[NSData alloc] initWithBase64EncodedString:salt options:0];
36
+
37
+ NSUInteger keyLengthBytes = (NSUInteger)keyLength;
38
+ NSMutableData *derivedKey = [NSMutableData dataWithLength:keyLengthBytes];
39
+
40
+ CCPseudoRandomAlgorithm prf = kCCPRFHmacAlgSHA1;
41
+ if ([hash isEqualToString:@"sha-512"]) {
42
+ prf = kCCPRFHmacAlgSHA512;
43
+ } else if ([hash isEqualToString:@"sha-256"]) {
44
+ prf = kCCPRFHmacAlgSHA256;
45
+ }
46
+
47
+ CCKeyDerivationPBKDF(
48
+ kCCPBKDF2,
49
+ passwordData.bytes, passwordData.length,
50
+ saltData.bytes, saltData.length,
51
+ prf,
52
+ (unsigned int)rounds,
53
+ derivedKey.mutableBytes, derivedKey.length);
54
+
55
+ resolve([derivedKey base64EncodedStringWithOptions:0]);
56
+ } @catch (NSException *exception) {
57
+ reject(@"derive_fail", exception.reason, nil);
58
+ }
59
+ });
60
+ }
61
+
62
+ @end
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import { TurboModuleRegistry } from 'react-native';
4
+ export default TurboModuleRegistry.getEnforcing('Pbkdf2');
5
+ //# sourceMappingURL=NativePbkdf2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativePbkdf2.ts"],"mappings":";;AAAA,SAASA,mBAAmB,QAAQ,cAAc;AAalD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,QAAQ,CAAC","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ import NativePbkdf2 from "./NativePbkdf2.js";
4
+ export default NativePbkdf2;
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativePbkdf2"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,mBAAgB;AAEzC,eAAeA,YAAY","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,7 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ derive(password: string, salt: string, rounds: number, keyLength: number, hash: string): Promise<string>;
4
+ }
5
+ declare const _default: Spec;
6
+ export default _default;
7
+ //# sourceMappingURL=NativePbkdf2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativePbkdf2.d.ts","sourceRoot":"","sources":["../../../src/NativePbkdf2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,MAAM,CACJ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;;AAED,wBAAgE"}
@@ -0,0 +1,4 @@
1
+ import NativePbkdf2 from './NativePbkdf2';
2
+ export default NativePbkdf2;
3
+ export type { Spec as Pbkdf2Spec } from './NativePbkdf2';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,eAAe,YAAY,CAAC;AAC5B,YAAY,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,155 @@
1
+ {
2
+ "name": "@onekeyfe/react-native-pbkdf2",
3
+ "version": "1.1.55",
4
+ "description": "react-native-pbkdf2",
5
+ "main": "./lib/module/index.js",
6
+ "types": "./lib/typescript/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.tsx",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "default": "./lib/module/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "ios",
19
+ "*.podspec",
20
+ "!ios/build",
21
+ "!**/__tests__",
22
+ "!**/__fixtures__",
23
+ "!**/__mocks__",
24
+ "!**/.*"
25
+ ],
26
+ "scripts": {
27
+ "clean": "del-cli ios/build lib",
28
+ "prepare": "bob build",
29
+ "typecheck": "tsc",
30
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
31
+ "test": "jest",
32
+ "release": "yarn prepare && npm whoami && npm publish --access public"
33
+ },
34
+ "keywords": [
35
+ "react-native",
36
+ "ios",
37
+ "android"
38
+ ],
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/OneKeyHQ/app-modules/react-native-pbkdf2.git"
42
+ },
43
+ "author": "@onekeyhq <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
44
+ "license": "MIT",
45
+ "bugs": {
46
+ "url": "https://github.com/OneKeyHQ/app-modules/react-native-pbkdf2/issues"
47
+ },
48
+ "homepage": "https://github.com/OneKeyHQ/app-modules/react-native-pbkdf2#readme",
49
+ "publishConfig": {
50
+ "registry": "https://registry.npmjs.org/"
51
+ },
52
+ "devDependencies": {
53
+ "@commitlint/config-conventional": "^19.8.1",
54
+ "@eslint/compat": "^1.3.2",
55
+ "@eslint/eslintrc": "^3.3.1",
56
+ "@eslint/js": "^9.35.0",
57
+ "@react-native/babel-preset": "0.83.0",
58
+ "@react-native/eslint-config": "0.83.0",
59
+ "@release-it/conventional-changelog": "^10.0.1",
60
+ "@types/jest": "^29.5.14",
61
+ "@types/react": "^19.2.0",
62
+ "commitlint": "^19.8.1",
63
+ "del-cli": "^6.0.0",
64
+ "eslint": "^9.35.0",
65
+ "eslint-config-prettier": "^10.1.8",
66
+ "eslint-plugin-prettier": "^5.5.4",
67
+ "jest": "^29.7.0",
68
+ "lefthook": "^2.0.3",
69
+ "prettier": "^2.8.8",
70
+ "react": "19.2.0",
71
+ "react-native": "patch:react-native@npm%3A0.83.0#~/.yarn/patches/react-native-npm-0.83.0-577d0f2d83.patch",
72
+ "react-native-builder-bob": "^0.40.17",
73
+ "release-it": "^19.0.4",
74
+ "turbo": "^2.5.6",
75
+ "typescript": "^5.9.2"
76
+ },
77
+ "peerDependencies": {
78
+ "react": "*",
79
+ "react-native": "*"
80
+ },
81
+ "react-native-builder-bob": {
82
+ "source": "src",
83
+ "output": "lib",
84
+ "targets": [
85
+ [
86
+ "module",
87
+ {
88
+ "esm": true
89
+ }
90
+ ],
91
+ [
92
+ "typescript",
93
+ {
94
+ "project": "tsconfig.build.json"
95
+ }
96
+ ]
97
+ ]
98
+ },
99
+ "codegenConfig": {
100
+ "name": "Pbkdf2Spec",
101
+ "type": "modules",
102
+ "jsSrcsDir": "src",
103
+ "android": {
104
+ "javaPackageName": "com.pbkdf2"
105
+ }
106
+ },
107
+ "prettier": {
108
+ "quoteProps": "consistent",
109
+ "singleQuote": true,
110
+ "tabWidth": 2,
111
+ "trailingComma": "es5",
112
+ "useTabs": false
113
+ },
114
+ "jest": {
115
+ "preset": "react-native",
116
+ "modulePathIgnorePatterns": [
117
+ "<rootDir>/lib/"
118
+ ]
119
+ },
120
+ "commitlint": {
121
+ "extends": [
122
+ "@commitlint/config-conventional"
123
+ ]
124
+ },
125
+ "release-it": {
126
+ "git": {
127
+ "commitMessage": "chore: release ${version}",
128
+ "tagName": "v${version}"
129
+ },
130
+ "npm": {
131
+ "publish": true
132
+ },
133
+ "github": {
134
+ "release": true
135
+ },
136
+ "plugins": {
137
+ "@release-it/conventional-changelog": {
138
+ "preset": {
139
+ "name": "angular"
140
+ }
141
+ }
142
+ }
143
+ },
144
+ "create-react-native-library": {
145
+ "type": "turbo-module",
146
+ "languages": "kotlin-objc",
147
+ "tools": [
148
+ "eslint",
149
+ "jest",
150
+ "lefthook",
151
+ "release-it"
152
+ ],
153
+ "version": "0.56.0"
154
+ }
155
+ }
@@ -0,0 +1,14 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ import type { TurboModule } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ derive(
6
+ password: string,
7
+ salt: string,
8
+ rounds: number,
9
+ keyLength: number,
10
+ hash: string,
11
+ ): Promise<string>;
12
+ }
13
+
14
+ export default TurboModuleRegistry.getEnforcing<Spec>('Pbkdf2');
package/src/index.tsx ADDED
@@ -0,0 +1,4 @@
1
+ import NativePbkdf2 from './NativePbkdf2';
2
+
3
+ export default NativePbkdf2;
4
+ export type { Spec as Pbkdf2Spec } from './NativePbkdf2';