@nuggetslife/vc-rn 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.
Files changed (137) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +31 -0
  3. package/android/build.gradle +101 -0
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +3 -0
  6. package/android/src/main/AndroidManifestNew.xml +2 -0
  7. package/android/src/main/java/com/nuggetslife/bindings/vc/vc.kt +673 -0
  8. package/android/src/main/java/com/nuggetslife/vc/VcModule.kt +30 -0
  9. package/android/src/main/java/com/nuggetslife/vc/VcPackage.kt +17 -0
  10. package/android/src/main/jniLibs/arm64-v8a/libvc.so +0 -0
  11. package/android/src/main/jniLibs/armeabi-v7a/libvc.so +0 -0
  12. package/android/src/main/jniLibs/x86/libvc.so +0 -0
  13. package/android/src/main/jniLibs/x86_64/libvc.so +0 -0
  14. package/ios/Vc-Bridging-Header.h +2 -0
  15. package/ios/VcModule.mm +14 -0
  16. package/ios/VcModule.swift +23 -0
  17. package/ios/vc.swift +446 -0
  18. package/ios/vc.xcframework/Info.plist +48 -0
  19. package/ios/vc.xcframework/ios-arm64/Headers/module.modulemap +6 -0
  20. package/ios/vc.xcframework/ios-arm64/Headers/vcFFI.h +174 -0
  21. package/ios/vc.xcframework/ios-arm64/libvc.a +0 -0
  22. package/ios/vc.xcframework/ios-arm64_x86_64-simulator/Headers/module.modulemap +6 -0
  23. package/ios/vc.xcframework/ios-arm64_x86_64-simulator/Headers/vcFFI.h +174 -0
  24. package/ios/vc.xcframework/ios-arm64_x86_64-simulator/libvc.a +0 -0
  25. package/ios/vcFFI.h +174 -0
  26. package/lib/commonjs/Bls12381G2KeyPair.js +405 -0
  27. package/lib/commonjs/Bls12381G2KeyPair.js.map +1 -0
  28. package/lib/commonjs/index.d.js +18 -0
  29. package/lib/commonjs/index.d.js.map +1 -0
  30. package/lib/commonjs/index.js +20 -0
  31. package/lib/commonjs/index.js.map +1 -0
  32. package/lib/commonjs/types/BlsCurveName.js +14 -0
  33. package/lib/commonjs/types/BlsCurveName.js.map +1 -0
  34. package/lib/commonjs/types/GenerateKeyPairOptions.js +2 -0
  35. package/lib/commonjs/types/GenerateKeyPairOptions.js.map +1 -0
  36. package/lib/commonjs/types/JsonWebKey.js +2 -0
  37. package/lib/commonjs/types/JsonWebKey.js.map +1 -0
  38. package/lib/commonjs/types/JwkKeyPairOptions.js +6 -0
  39. package/lib/commonjs/types/JwkKeyPairOptions.js.map +1 -0
  40. package/lib/commonjs/types/JwkKty.js +13 -0
  41. package/lib/commonjs/types/JwkKty.js.map +1 -0
  42. package/lib/commonjs/types/KeyPairOptions.js +2 -0
  43. package/lib/commonjs/types/KeyPairOptions.js.map +1 -0
  44. package/lib/commonjs/types/KeyPairSigner.js +2 -0
  45. package/lib/commonjs/types/KeyPairSigner.js.map +1 -0
  46. package/lib/commonjs/types/KeyPairVerifier.js +2 -0
  47. package/lib/commonjs/types/KeyPairVerifier.js.map +1 -0
  48. package/lib/commonjs/types/index.js +20 -0
  49. package/lib/commonjs/types/index.js.map +1 -0
  50. package/lib/commonjs/utils/codec.js +22 -0
  51. package/lib/commonjs/utils/codec.js.map +1 -0
  52. package/lib/commonjs/utils/index.js +19 -0
  53. package/lib/commonjs/utils/index.js.map +1 -0
  54. package/lib/commonjs/validators/Bls12381G2Jwk.js +19 -0
  55. package/lib/commonjs/validators/Bls12381G2Jwk.js.map +1 -0
  56. package/lib/commonjs/validators/JsonWebKey.js +27 -0
  57. package/lib/commonjs/validators/JsonWebKey.js.map +1 -0
  58. package/lib/module/Bls12381G2KeyPair.js +398 -0
  59. package/lib/module/Bls12381G2KeyPair.js.map +1 -0
  60. package/lib/module/index.d.js +9 -0
  61. package/lib/module/index.d.js.map +1 -0
  62. package/lib/module/index.js +14 -0
  63. package/lib/module/index.js.map +1 -0
  64. package/lib/module/types/BlsCurveName.js +8 -0
  65. package/lib/module/types/BlsCurveName.js.map +1 -0
  66. package/lib/module/types/GenerateKeyPairOptions.js +2 -0
  67. package/lib/module/types/GenerateKeyPairOptions.js.map +1 -0
  68. package/lib/module/types/JsonWebKey.js +2 -0
  69. package/lib/module/types/JsonWebKey.js.map +1 -0
  70. package/lib/module/types/JwkKeyPairOptions.js +2 -0
  71. package/lib/module/types/JwkKeyPairOptions.js.map +1 -0
  72. package/lib/module/types/JwkKty.js +7 -0
  73. package/lib/module/types/JwkKty.js.map +1 -0
  74. package/lib/module/types/KeyPairOptions.js +2 -0
  75. package/lib/module/types/KeyPairOptions.js.map +1 -0
  76. package/lib/module/types/KeyPairSigner.js +2 -0
  77. package/lib/module/types/KeyPairSigner.js.map +1 -0
  78. package/lib/module/types/KeyPairVerifier.js +2 -0
  79. package/lib/module/types/KeyPairVerifier.js.map +1 -0
  80. package/lib/module/types/index.js +3 -0
  81. package/lib/module/types/index.js.map +1 -0
  82. package/lib/module/utils/codec.js +13 -0
  83. package/lib/module/utils/codec.js.map +1 -0
  84. package/lib/module/utils/index.js +2 -0
  85. package/lib/module/utils/index.js.map +1 -0
  86. package/lib/module/validators/Bls12381G2Jwk.js +11 -0
  87. package/lib/module/validators/Bls12381G2Jwk.js.map +1 -0
  88. package/lib/module/validators/JsonWebKey.js +19 -0
  89. package/lib/module/validators/JsonWebKey.js.map +1 -0
  90. package/lib/typescript/src/Bls12381G2KeyPair.d.ts +104 -0
  91. package/lib/typescript/src/Bls12381G2KeyPair.d.ts.map +1 -0
  92. package/lib/typescript/src/index.d.ts +2 -0
  93. package/lib/typescript/src/index.d.ts.map +1 -0
  94. package/lib/typescript/src/types/BlsCurveName.d.ts +7 -0
  95. package/lib/typescript/src/types/BlsCurveName.d.ts.map +1 -0
  96. package/lib/typescript/src/types/GenerateKeyPairOptions.d.ts +18 -0
  97. package/lib/typescript/src/types/GenerateKeyPairOptions.d.ts.map +1 -0
  98. package/lib/typescript/src/types/JsonWebKey.d.ts +60 -0
  99. package/lib/typescript/src/types/JsonWebKey.d.ts.map +1 -0
  100. package/lib/typescript/src/types/JwkKeyPairOptions.d.ts +23 -0
  101. package/lib/typescript/src/types/JwkKeyPairOptions.d.ts.map +1 -0
  102. package/lib/typescript/src/types/JwkKty.d.ts +6 -0
  103. package/lib/typescript/src/types/JwkKty.d.ts.map +1 -0
  104. package/lib/typescript/src/types/KeyPairOptions.d.ts +22 -0
  105. package/lib/typescript/src/types/KeyPairOptions.d.ts.map +1 -0
  106. package/lib/typescript/src/types/KeyPairSigner.d.ts +7 -0
  107. package/lib/typescript/src/types/KeyPairSigner.d.ts.map +1 -0
  108. package/lib/typescript/src/types/KeyPairVerifier.d.ts +8 -0
  109. package/lib/typescript/src/types/KeyPairVerifier.d.ts.map +1 -0
  110. package/lib/typescript/src/types/index.d.ts +9 -0
  111. package/lib/typescript/src/types/index.d.ts.map +1 -0
  112. package/lib/typescript/src/utils/codec.d.ts +3 -0
  113. package/lib/typescript/src/utils/codec.d.ts.map +1 -0
  114. package/lib/typescript/src/utils/index.d.ts +2 -0
  115. package/lib/typescript/src/utils/index.d.ts.map +1 -0
  116. package/lib/typescript/src/validators/Bls12381G2Jwk.d.ts +4 -0
  117. package/lib/typescript/src/validators/Bls12381G2Jwk.d.ts.map +1 -0
  118. package/lib/typescript/src/validators/JsonWebKey.d.ts +4 -0
  119. package/lib/typescript/src/validators/JsonWebKey.d.ts.map +1 -0
  120. package/nuggetslife-vc.podspec +42 -0
  121. package/package.json +164 -0
  122. package/src/Bls12381G2KeyPair.ts +447 -0
  123. package/src/index.d.ts +126 -0
  124. package/src/index.tsx +22 -0
  125. package/src/types/BlsCurveName.ts +6 -0
  126. package/src/types/GenerateKeyPairOptions.ts +17 -0
  127. package/src/types/JsonWebKey.ts +68 -0
  128. package/src/types/JwkKeyPairOptions.ts +24 -0
  129. package/src/types/JwkKty.ts +5 -0
  130. package/src/types/KeyPairOptions.ts +21 -0
  131. package/src/types/KeyPairSigner.ts +6 -0
  132. package/src/types/KeyPairVerifier.ts +8 -0
  133. package/src/types/index.ts +8 -0
  134. package/src/utils/codec.ts +12 -0
  135. package/src/utils/index.ts +1 -0
  136. package/src/validators/Bls12381G2Jwk.ts +21 -0
  137. package/src/validators/JsonWebKey.ts +28 -0
@@ -0,0 +1,104 @@
1
+ /// <reference types="node" />
2
+ import { type GenerateKeyPairOptions, type JsonWebKey, type JwkKeyPairOptions, type KeyPairOptions, type KeyPairSigner, type KeyPairVerifier } from './types';
3
+ export declare class Bls12381G2KeyPair {
4
+ id?: string;
5
+ controller?: string;
6
+ privateKeyInner?: Array<number>;
7
+ publicKeyInner?: Array<number>;
8
+ type: string;
9
+ constructor(options?: KeyPairOptions | undefined | null);
10
+ /**
11
+ * Generates a BLS 12-381 key pair
12
+ * @param options [Optional] options for the key pair generation
13
+ *
14
+ * @returns A BLS 12-381 key pair
15
+ */
16
+ static generate(options?: GenerateKeyPairOptions): Promise<Bls12381G2KeyPair>;
17
+ /**
18
+ * Constructs a BLS 12-381 key pair from options
19
+ * @param options [Optional] options for key pair
20
+ *
21
+ * @returns A BLS 12-381 key pair
22
+ */
23
+ static from(options: KeyPairOptions): Promise<Bls12381G2KeyPair>;
24
+ /**
25
+ * Constructs a BLS 12-381 key pair from options
26
+ * @param options [Optional] options for key pair
27
+ *
28
+ * @returns A BLS 12-381 G2 key pair
29
+ */
30
+ static fromJwk(options: JwkKeyPairOptions): Promise<Bls12381G2KeyPair>;
31
+ /**
32
+ * Constructs a BLS 12-381 key pair from a public key fingerprint
33
+ * @param fingerprint [Optional] public key fingerprint
34
+ *
35
+ * TODO this interface needs to be refactored, there should be no
36
+ * hard coded notion of DIDs at this layer
37
+ *
38
+ * @returns A BLS 12-381 key pair
39
+ */
40
+ static fromFingerprint({ id, controller, fingerprint, }: any): Bls12381G2KeyPair;
41
+ /**
42
+ * Returns the base58 encoded public key.
43
+ *
44
+ * @returns The base58 encoded public key.
45
+ */
46
+ get publicKey(): string;
47
+ /**
48
+ * Returns the JWK structured public key.
49
+ *
50
+ * @returns The JWK public key.
51
+ */
52
+ get publicKeyJwk(): JsonWebKey;
53
+ /**
54
+ * Returns the base58 encoded private key.
55
+ *
56
+ * @returns The base58 encoded private key.
57
+ */
58
+ get privateKey(): string | undefined;
59
+ /**
60
+ * Returns the JWK formatted private key.
61
+ *
62
+ * @returns The JWK formatted private key.
63
+ */
64
+ get privateKeyJwk(): JsonWebKey | undefined;
65
+ /**
66
+ * Adds a public key base to a public key node.
67
+ *
68
+ * @param publicKeyNode - The public key node.
69
+ * @param publicKeyNode.publicKeyBase58 - Base58 public key.
70
+ *
71
+ * @returns A PublicKeyNode in a block.
72
+ */
73
+ addEncodedPublicKey(publicKeyNode: any): any;
74
+ get publicKeyBuffer(): Buffer;
75
+ get privateKeyBuffer(): Buffer;
76
+ /**
77
+ * Returns a signer object for use with jsonld-signatures.
78
+ *
79
+ * @returns {{sign: Function}} A signer for the json-ld block.
80
+ */
81
+ signer(): KeyPairSigner;
82
+ /**
83
+ * Returns a verifier object for use with jsonld-signatures.
84
+ *
85
+ * @returns {{verify: Function}} Used to verify jsonld-signatures.
86
+ */
87
+ verifier(): KeyPairVerifier;
88
+ /**
89
+ * Generates and returns a public key fingerprint.
90
+ *
91
+ * @returns The fingerprint.
92
+ */
93
+ fingerprint(): string;
94
+ static fingerprintFromPublicKey({ publicKeyBase58 }: any): string;
95
+ /**
96
+ * Verifies whether the fingerprint was generated from a given key pair.
97
+ *
98
+ * @param fingerprint - A Base58 public key.
99
+ *
100
+ * @returns An object indicating valid is true or false.
101
+ */
102
+ verifyFingerprint(fingerprint: string): any;
103
+ }
104
+ //# sourceMappingURL=Bls12381G2KeyPair.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bls12381G2KeyPair.d.ts","sourceRoot":"","sources":["../../../src/Bls12381G2KeyPair.ts"],"names":[],"mappings":";AAOA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC;AAiGjB,qBAAa,iBAAiB;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,cAAc,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,SAAuB;gBAEf,OAAO,CAAC,EAAE,cAAc,GAAG,SAAS,GAAG,IAAI;IAuCvD;;;;;OAKG;WACU,QAAQ,CACnB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,iBAAiB,CAAC;IAiB7B;;;;;OAKG;WACU,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAGtE;;;;;OAKG;WACU,OAAO,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6B5E;;;;;;;;OAQG;IACH,MAAM,CAAC,eAAe,CAAC,EACrB,EAAE,EACF,UAAU,EACV,WAAW,GACZ,EAAE,GAAG,GAAG,iBAAiB;IAwD1B;;;;OAIG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;;;OAIG;IACH,IAAI,YAAY,IAAI,UAAU,CAO7B;IAED;;;;OAIG;IACH,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAKnC;IAED;;;;OAIG;IACH,IAAI,aAAa,IAAI,UAAU,GAAG,SAAS,CAW1C;IAED;;;;;;;OAOG;IACH,mBAAmB,CAAC,aAAa,EAAE,GAAG,GAAG,GAAG;IAI5C,IAAI,eAAe,IAAI,MAAM,CAE5B;IACD,IAAI,gBAAgB,IAAI,MAAM,CAE7B;IAED;;;;OAIG;IACH,MAAM,IAAI,aAAa;IAIvB;;;;OAIG;IACH,QAAQ,IAAI,eAAe;IAI3B;;;;OAIG;IACH,WAAW,IAAI,MAAM;IAIrB,MAAM,CAAC,wBAAwB,CAAC,EAAE,eAAe,EAAE,EAAE,GAAG,GAAG,MAAM;IAUjE;;;;;;OAMG;IACH,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,GAAG;CAkC5C"}
@@ -0,0 +1,2 @@
1
+ export declare function vc_facade(action: string, options: string): Promise<string>;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1E"}
@@ -0,0 +1,7 @@
1
+ export declare enum BlsCurveName {
2
+ DEPRECATED_G1 = "BLS12381_G1",
3
+ DEPRECATED_G2 = "BLS12381_G2",
4
+ G1 = "Bls12381G1",
5
+ G2 = "Bls12381G2"
6
+ }
7
+ //# sourceMappingURL=BlsCurveName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BlsCurveName.d.ts","sourceRoot":"","sources":["../../../../src/types/BlsCurveName.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,aAAa,gBAAgB;IAC7B,aAAa,gBAAgB;IAC7B,EAAE,eAAe;IACjB,EAAE,eAAe;CAClB"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Options for generating a new key pair
3
+ */
4
+ export interface GenerateKeyPairOptions {
5
+ /**
6
+ * The key id
7
+ */
8
+ readonly id?: string;
9
+ /**
10
+ * The key controller
11
+ */
12
+ readonly controller?: string;
13
+ /**
14
+ * An optional seed to derive the key pair from
15
+ */
16
+ readonly seed?: Uint8Array;
17
+ }
18
+ //# sourceMappingURL=GenerateKeyPairOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenerateKeyPairOptions.d.ts","sourceRoot":"","sources":["../../../../src/types/GenerateKeyPairOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;CAC5B"}
@@ -0,0 +1,60 @@
1
+ export interface JsonWebKey {
2
+ /**
3
+ * Indicates the key type used
4
+ * For BLS12381_G1 and BLS12381_G2 the string "EC" MUST be used
5
+ *
6
+ * @see https://tools.ietf.org/html/rfc7517#section-4.1
7
+ */
8
+ kty: string;
9
+ /**
10
+ * Indicates the curve this key is associated with
11
+ * In the case of BLS12-381, the curve will also indicate if it's a G1 or G2 point
12
+ *
13
+ * For a G1 point, use the string "BLS12381_G1"
14
+ * For a G2 point, use the string "BLS12381_G2"
15
+ */
16
+ crv: string;
17
+ /**
18
+ * This is a compression of the public key point
19
+ *
20
+ * For a G1 public key, X is a 384bit base64url encoding of the octet string representation of the coordinate
21
+ * For a G2 public key, X is a 768bit made up of the concatenation of two 384 bit x coordinates known as
22
+ * x_a and x_b in the following form (x_a || x_b) as a base64url encoding of the octet string representation of the two coordinates
23
+ */
24
+ x: string;
25
+ /**
26
+ * @see https://tools.ietf.org/html/rfc7517#section-4.2
27
+ */
28
+ use?: string;
29
+ /**
30
+ * @see https://tools.ietf.org/html/rfc7517#section-4.3
31
+ */
32
+ key_ops?: string[];
33
+ /**
34
+ * @see https://tools.ietf.org/html/rfc7517#section-4.4
35
+ */
36
+ alg?: string;
37
+ /**
38
+ * @see https://tools.ietf.org/html/rfc7517#section-4.5
39
+ *
40
+ * TODO: Add note about referencing did-jose-extensions when ready
41
+ */
42
+ kid?: string;
43
+ /**
44
+ *
45
+ * IMPORTANT NOTE: d represents the private key value and should not be shared
46
+ * IT IS HIGHLY SENSITIVE DATA AND IF NOT SECURED PROPERLY CONSIDER THE KEY COMPROMISED
47
+ *
48
+ * @see https://tools.ietf.org/html/rfc7517#section-9.2
49
+ */
50
+ d?: string;
51
+ /**
52
+ * This coordinate is not used for BLS Keys, but is kept here to make the interface more standard
53
+ */
54
+ y?: string;
55
+ /**
56
+ * @see https://www.w3.org/TR/WebCryptoAPI/#cryptokey-interface-members
57
+ */
58
+ ext?: boolean;
59
+ }
60
+ //# sourceMappingURL=JsonWebKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonWebKey.d.ts","sourceRoot":"","sources":["../../../../src/types/JsonWebKey.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;;;OAMG;IACH,CAAC,EAAE,MAAM,CAAC;IAEV;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf"}
@@ -0,0 +1,23 @@
1
+ import type { JsonWebKey } from "./JsonWebKey";
2
+ /**
3
+ * Options for constructing a key pair
4
+ */
5
+ export interface JwkKeyPairOptions {
6
+ /**
7
+ * The key id
8
+ */
9
+ readonly id?: string;
10
+ /**
11
+ * The key controller
12
+ */
13
+ readonly controller?: string;
14
+ /**
15
+ * Base58 encoding of the private key
16
+ */
17
+ readonly privateKeyJwk?: JsonWebKey;
18
+ /**
19
+ * Base58 encoding of the public key
20
+ */
21
+ readonly publicKeyJwk: JsonWebKey;
22
+ }
23
+ //# sourceMappingURL=JwkKeyPairOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JwkKeyPairOptions.d.ts","sourceRoot":"","sources":["../../../../src/types/JwkKeyPairOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,UAAU,CAAC;IACpC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;CACnC"}
@@ -0,0 +1,6 @@
1
+ export declare enum JwkKty {
2
+ OctetKeyPair = "OKP",
3
+ EC = "EC",
4
+ RSA = "RSA"
5
+ }
6
+ //# sourceMappingURL=JwkKty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JwkKty.d.ts","sourceRoot":"","sources":["../../../../src/types/JwkKty.ts"],"names":[],"mappings":"AAAA,oBAAY,MAAM;IAChB,YAAY,QAAQ;IACpB,EAAE,OAAO;IACT,GAAG,QAAQ;CACZ"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Options for constructing a key pair
3
+ */
4
+ export interface KeyPairOptions {
5
+ /**
6
+ * The key id
7
+ */
8
+ readonly id?: string;
9
+ /**
10
+ * The key controller
11
+ */
12
+ readonly controller?: string;
13
+ /**
14
+ * Base58 encoding of the private key
15
+ */
16
+ readonly privateKeyBase58?: string;
17
+ /**
18
+ * Base58 encoding of the public key
19
+ */
20
+ readonly publicKeyBase58: string;
21
+ }
22
+ //# sourceMappingURL=KeyPairOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyPairOptions.d.ts","sourceRoot":"","sources":["../../../../src/types/KeyPairOptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC"}
@@ -0,0 +1,7 @@
1
+ export interface KeyPairSignerOptions {
2
+ data: Array<Uint8Array>;
3
+ }
4
+ export interface KeyPairSigner {
5
+ sign(options: KeyPairSignerOptions): Promise<Uint8Array>;
6
+ }
7
+ //# sourceMappingURL=KeyPairSigner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyPairSigner.d.ts","sourceRoot":"","sources":["../../../../src/types/KeyPairSigner.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CACzB;AACD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC1D"}
@@ -0,0 +1,8 @@
1
+ export interface KeyPairVerifierOptions {
2
+ data: Array<Uint8Array>;
3
+ signature: Uint8Array;
4
+ }
5
+ export interface KeyPairVerifier {
6
+ verify(options: KeyPairVerifierOptions): Promise<boolean>;
7
+ }
8
+ //# sourceMappingURL=KeyPairVerifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyPairVerifier.d.ts","sourceRoot":"","sources":["../../../../src/types/KeyPairVerifier.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;IACvB,SAAS,EAAE,UAAU,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC1D"}
@@ -0,0 +1,9 @@
1
+ export { BlsCurveName } from "./BlsCurveName";
2
+ export type { GenerateKeyPairOptions } from "./GenerateKeyPairOptions";
3
+ export type { JsonWebKey } from "./JsonWebKey";
4
+ export { JwkKty } from "./JwkKty";
5
+ export type { JwkKeyPairOptions } from "./JwkKeyPairOptions";
6
+ export type { KeyPairOptions } from "./KeyPairOptions";
7
+ export type { KeyPairSigner } from "./KeyPairSigner";
8
+ export type { KeyPairVerifier } from "./KeyPairVerifier";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const convertBase64urlToBase58: (value: string) => string;
2
+ export declare function uint8ArrayToHexString(arr: Uint8Array): string;
3
+ //# sourceMappingURL=codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../../src/utils/codec.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,wBAAwB,UAAW,MAAM,KAAG,MAExD,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,UAAU,UAIpD"}
@@ -0,0 +1,2 @@
1
+ export { convertBase64urlToBase58, uint8ArrayToHexString } from "./codec";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { JsonWebKey } from "../types";
2
+ export declare const assertBls12381G2PublicJwk: (jwk: JsonWebKey) => boolean;
3
+ export declare const assertBls12381G2PrivateJwk: (jwk: JsonWebKey) => boolean;
4
+ //# sourceMappingURL=Bls12381G2Jwk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bls12381G2Jwk.d.ts","sourceRoot":"","sources":["../../../../src/validators/Bls12381G2Jwk.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,eAAO,MAAM,yBAAyB,QAAS,UAAU,KAAG,OAO3D,CAAC;AAEF,eAAO,MAAM,0BAA0B,QAAS,UAAU,KAAG,OAO5D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { JsonWebKey } from "../types";
2
+ export declare const assertPublicBlsJwk: (jwk: JsonWebKey) => boolean;
3
+ export declare const assertPrivateBlsJwk: (jwk: JsonWebKey) => boolean;
4
+ //# sourceMappingURL=JsonWebKey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JsonWebKey.d.ts","sourceRoot":"","sources":["../../../../src/validators/JsonWebKey.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAkB3C,eAAO,MAAM,kBAAkB,QAAS,UAAU,KAAG,OAIpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAS,UAAU,KAAG,OAErD,CAAC"}
@@ -0,0 +1,42 @@
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 = "nuggetslife-vc"
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 => min_ios_version_supported }
15
+ s.source = { :git => "https://github.com/NuggetsLtd/clientffi.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
18
+ s.vendored_frameworks = "ios/*.xcframework"
19
+
20
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
21
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
22
+ if respond_to?(:install_modules_dependencies, true)
23
+ install_modules_dependencies(s)
24
+ else
25
+ s.dependency "React-Core"
26
+
27
+ # Don't install the dependencies when we run `pod install` in the old architecture.
28
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
29
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
30
+ s.pod_target_xcconfig = {
31
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
32
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
33
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
34
+ }
35
+ s.dependency "React-Codegen"
36
+ s.dependency "RCT-Folly"
37
+ s.dependency "RCTRequired"
38
+ s.dependency "RCTTypeSafety"
39
+ s.dependency "ReactCommon/turbomodule/core"
40
+ end
41
+ end
42
+ end
package/package.json ADDED
@@ -0,0 +1,164 @@
1
+ {
2
+ "name": "@nuggetslife/vc-rn",
3
+ "version": "0.1.0",
4
+ "description": "verifiable credential utils",
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
+ "scripts": {
29
+ "example": "yarn workspace @nuggetslife/vc-example",
30
+ "test": "jest",
31
+ "typecheck": "tsc --noEmit",
32
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
34
+ "prepare": "bob build",
35
+ "release": "release-it"
36
+ },
37
+ "keywords": [
38
+ "react-native",
39
+ "ios",
40
+ "android"
41
+ ],
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/NuggetsLtd/clientffi.git"
45
+ },
46
+ "author": "Harry Anderson <harry@nuggets.life> (https://github.com/harry-anderson)",
47
+ "license": "MIT",
48
+ "bugs": {
49
+ "url": "https://github.com/NuggetsLtd/clientffi/issues"
50
+ },
51
+ "homepage": "https://github.com/NuggetsLtd/clientffi#readme",
52
+ "publishConfig": {
53
+ "registry": "https://registry.npmjs.org/"
54
+ },
55
+ "devDependencies": {
56
+ "@commitlint/config-conventional": "^17.0.2",
57
+ "@evilmartians/lefthook": "^1.5.0",
58
+ "@react-native/eslint-config": "^0.73.1",
59
+ "@release-it/conventional-changelog": "^5.0.0",
60
+ "@types/jest": "^29.5.5",
61
+ "@types/react": "^18.2.44",
62
+ "commitlint": "^17.0.2",
63
+ "del-cli": "^5.1.0",
64
+ "eslint": "^8.51.0",
65
+ "eslint-config-prettier": "^9.0.0",
66
+ "eslint-plugin-prettier": "^5.0.1",
67
+ "jest": "^29.7.0",
68
+ "prettier": "^3.0.3",
69
+ "react": "18.2.0",
70
+ "react-native": "0.74.2",
71
+ "react-native-builder-bob": "^0.20.0",
72
+ "release-it": "^15.0.0",
73
+ "turbo": "^1.10.7",
74
+ "typescript": "^5.2.2"
75
+ },
76
+ "resolutions": {
77
+ "@types/react": "^18.2.44"
78
+ },
79
+ "peerDependencies": {
80
+ "react": "*",
81
+ "react-native": "*"
82
+ },
83
+ "workspaces": [
84
+ "example"
85
+ ],
86
+ "packageManager": "yarn@3.6.1",
87
+ "jest": {
88
+ "preset": "react-native",
89
+ "modulePathIgnorePatterns": [
90
+ "<rootDir>/example/node_modules",
91
+ "<rootDir>/lib/"
92
+ ]
93
+ },
94
+ "commitlint": {
95
+ "extends": [
96
+ "@commitlint/config-conventional"
97
+ ]
98
+ },
99
+ "release-it": {
100
+ "git": {
101
+ "commitMessage": "chore: release ${version}",
102
+ "tagName": "v${version}"
103
+ },
104
+ "npm": {
105
+ "publish": true
106
+ },
107
+ "github": {
108
+ "release": true
109
+ },
110
+ "plugins": {
111
+ "@release-it/conventional-changelog": {
112
+ "preset": "angular"
113
+ }
114
+ }
115
+ },
116
+ "eslintConfig": {
117
+ "root": true,
118
+ "extends": [
119
+ "@react-native",
120
+ "prettier"
121
+ ],
122
+ "rules": {
123
+ "prettier/prettier": [
124
+ "error",
125
+ {
126
+ "quoteProps": "consistent",
127
+ "singleQuote": true,
128
+ "tabWidth": 2,
129
+ "trailingComma": "es5",
130
+ "useTabs": false
131
+ }
132
+ ]
133
+ }
134
+ },
135
+ "eslintIgnore": [
136
+ "node_modules/",
137
+ "lib/"
138
+ ],
139
+ "prettier": {
140
+ "quoteProps": "consistent",
141
+ "singleQuote": true,
142
+ "tabWidth": 2,
143
+ "trailingComma": "es5",
144
+ "useTabs": false
145
+ },
146
+ "react-native-builder-bob": {
147
+ "source": "src",
148
+ "output": "lib",
149
+ "targets": [
150
+ "commonjs",
151
+ "module",
152
+ [
153
+ "typescript",
154
+ {
155
+ "project": "tsconfig.build.json"
156
+ }
157
+ ]
158
+ ]
159
+ },
160
+ "dependencies": {
161
+ "bs58": "^6.0.0",
162
+ "rfc4648": "^1.5.3"
163
+ }
164
+ }