@nuggetslife/vc-rn 0.1.9 → 0.2.1
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/lib/commonjs/BbsBlsHolderBoundSignature2022.js +4 -9
- package/lib/commonjs/BbsBlsHolderBoundSignature2022.js.map +1 -1
- package/lib/commonjs/BbsBlsHolderBoundSignatureProof2022.js +3 -9
- package/lib/commonjs/BbsBlsHolderBoundSignatureProof2022.js.map +1 -1
- package/lib/commonjs/BbsBlsSignatureProof2020.js +0 -1
- package/lib/commonjs/BbsBlsSignatureProof2020.js.map +1 -1
- package/lib/commonjs/Bls12381G2KeyPair.js +3 -3
- package/lib/commonjs/Bls12381G2KeyPair.js.map +1 -1
- package/lib/commonjs/blind_signing.js +12 -30
- package/lib/commonjs/blind_signing.js.map +1 -1
- package/lib/commonjs/index.js +93 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/jose.js +228 -0
- package/lib/commonjs/jose.js.map +1 -0
- package/lib/commonjs/ld_signatures.js +3 -12
- package/lib/commonjs/ld_signatures.js.map +1 -1
- package/lib/commonjs/utils/codec.js +12 -0
- package/lib/commonjs/utils/codec.js.map +1 -1
- package/lib/commonjs/utils/index.js +12 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/BbsBlsHolderBoundSignature2022.js +1 -6
- package/lib/module/BbsBlsHolderBoundSignature2022.js.map +1 -1
- package/lib/module/BbsBlsHolderBoundSignatureProof2022.js +1 -7
- package/lib/module/BbsBlsHolderBoundSignatureProof2022.js.map +1 -1
- package/lib/module/BbsBlsSignatureProof2020.js +0 -1
- package/lib/module/BbsBlsSignatureProof2020.js.map +1 -1
- package/lib/module/Bls12381G2KeyPair.js +3 -3
- package/lib/module/Bls12381G2KeyPair.js.map +1 -1
- package/lib/module/blind_signing.js +1 -19
- package/lib/module/blind_signing.js.map +1 -1
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/jose.js +216 -0
- package/lib/module/jose.js.map +1 -0
- package/lib/module/ld_signatures.js +1 -10
- package/lib/module/ld_signatures.js.map +1 -1
- package/lib/module/utils/codec.js +11 -1
- package/lib/module/utils/codec.js.map +1 -1
- package/lib/module/utils/index.js +1 -1
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/src/BbsBlsHolderBoundSignature2022.d.ts.map +1 -1
- package/lib/typescript/src/BbsBlsHolderBoundSignatureProof2022.d.ts +0 -1
- package/lib/typescript/src/BbsBlsHolderBoundSignatureProof2022.d.ts.map +1 -1
- package/lib/typescript/src/BbsBlsSignatureProof2020.d.ts +0 -1
- package/lib/typescript/src/BbsBlsSignatureProof2020.d.ts.map +1 -1
- package/lib/typescript/src/blind_signing.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/jose.d.ts +106 -0
- package/lib/typescript/src/jose.d.ts.map +1 -0
- package/lib/typescript/src/ld_signatures.d.ts.map +1 -1
- package/lib/typescript/src/utils/codec.d.ts +2 -0
- package/lib/typescript/src/utils/codec.d.ts.map +1 -1
- package/lib/typescript/src/utils/index.d.ts +1 -1
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/BbsBlsHolderBoundSignature2022.ts +1 -5
- package/src/BbsBlsHolderBoundSignatureProof2022.ts +1 -7
- package/src/BbsBlsSignatureProof2020.ts +0 -2
- package/src/Bls12381G2KeyPair.ts +3 -3
- package/src/blind_signing.ts +1 -15
- package/src/index.tsx +20 -0
- package/src/jose.ts +246 -0
- package/src/ld_signatures.ts +1 -8
- package/src/utils/codec.ts +9 -1
- package/src/utils/index.ts +1 -1
- package/lib/commonjs/index.d.js +0 -18
- package/lib/commonjs/index.d.js.map +0 -1
- package/lib/module/index.d.js +0 -9
- package/lib/module/index.d.js.map +0 -1
- package/src/index.d.ts +0 -126
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["base64url","bs58","convertBase64urlToBase58","value","encode","parse","loose","uint8ArrayToHexString","arr","Array","prototype","map","call","byte","toString","slice","join"],"sourceRoot":"../../../src","sources":["utils/codec.ts"],"mappings":"AAAA,SAASA,SAAS,QAAQ,SAAS;
|
|
1
|
+
{"version":3,"names":["base64","base64url","bs58","convertBase64urlToBase58","value","encode","parse","loose","toBase64","data","stringify","pad","fromBase64","uint8ArrayToHexString","arr","Array","prototype","map","call","byte","toString","slice","join"],"sourceRoot":"../../../src","sources":["utils/codec.ts"],"mappings":"AAAA,SAASA,MAAM,EAAEC,SAAS,QAAQ,SAAS;AAC3C,OAAOC,IAAI,MAAM,MAAM;AAEvB,OAAO,MAAMC,wBAAwB,GAAIC,KAAa,IAAa;EACjE,OAAOF,IAAI,CAACG,MAAM,CAACJ,SAAS,CAACK,KAAK,CAACF,KAAK,EAAE;IAAEG,KAAK,EAAE;EAAK,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,OAAO,SAASC,QAAQA,CAACC,IAAgB,EAAU;EACjD,OAAOT,MAAM,CAACU,SAAS,CAACD,IAAI,EAAE;IAAEE,GAAG,EAAE;EAAK,CAAC,CAAC;AAC9C;AAEA,OAAO,SAASC,UAAUA,CAACH,IAAY,EAAc;EACnD,OAAOT,MAAM,CAACM,KAAK,CAACG,IAAI,EAAE;IAAEF,KAAK,EAAE;EAAK,CAAC,CAAC;AAC5C;AAEA,OAAO,SAASM,qBAAqBA,CAACC,GAAe,EAAE;EACrD,OAAOC,KAAK,CAACC,SAAS,CAACC,GAAG,CAACC,IAAI,CAACJ,GAAG,EAAE,UAASK,IAAI,EAAE;IAClD,OAAO,CAAC,GAAG,GAAG,CAACA,IAAI,GAAG,IAAI,EAAEC,QAAQ,CAAC,EAAE,CAAC,EAAEC,KAAK,CAAC,CAAC,CAAC,CAAC;EACrD,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;AACb","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { convertBase64urlToBase58, uint8ArrayToHexString } from "./codec";
|
|
1
|
+
export { convertBase64urlToBase58, fromBase64, toBase64, uint8ArrayToHexString } from "./codec";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["convertBase64urlToBase58","uint8ArrayToHexString"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,wBAAwB,EAAEC,qBAAqB,QAAQ,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["convertBase64urlToBase58","fromBase64","toBase64","uint8ArrayToHexString"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,wBAAwB,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,qBAAqB,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BbsBlsHolderBoundSignature2022.d.ts","sourceRoot":"","sources":["../../../src/BbsBlsHolderBoundSignature2022.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BbsBlsHolderBoundSignature2022.d.ts","sourceRoot":"","sources":["../../../src/BbsBlsHolderBoundSignature2022.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,0BAA0B;IACzC,GAAG,CAAC,EAAE;QACJ,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,GAAG,CAAC;IACd,cAAc,EAAE,UAAU,CAAC;IAC3B,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAKD,qBAAa,8BAA8B;IACzC,IAAI,SAAwC;IAC5C,OAAO,CAAC,GAAG,CAAC,CAKV;IACF,OAAO,CAAC,kBAAkB,CAAC,CAAS;IACpC,OAAO,CAAC,UAAU,CAAC,CAAa;IAChC,OAAO,CAAC,OAAO,CAAC,CAAW;gBAEf,OAAO,CAAC,EAAE,0BAA0B,GAAG,SAAS,GAAG,IAAI;IAUnE;;;OAGG;IACG,gCAAgC,CACpC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAaxD;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,GAAG,CAAC;IAsBjE;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC;QAC3D,QAAQ,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAaF;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,GAAG,GAAG,GAAG;IA0BtC,IAAI,SAAS,IAAI,MAAM,EAAE,CAMxB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BbsBlsHolderBoundSignatureProof2022.d.ts","sourceRoot":"","sources":["../../../src/BbsBlsHolderBoundSignatureProof2022.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BbsBlsHolderBoundSignatureProof2022.d.ts","sourceRoot":"","sources":["../../../src/BbsBlsHolderBoundSignatureProof2022.ts"],"names":[],"mappings":"AAGA,MAAM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IAAI,SAAkC;;
|
|
1
|
+
{"version":3,"file":"BbsBlsSignatureProof2020.d.ts","sourceRoot":"","sources":["../../../src/BbsBlsSignatureProof2020.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,GAAG,CAAC;IACd,cAAc,EAAE,GAAG,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,qBAAa,wBAAwB;IACnC,IAAI,SAAkC;IAEtC;;OAEG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC;IAa5D;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC;QAC7D,QAAQ,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAWF,IAAI,SAAS,IAAI,MAAM,EAAE,CAMxB;IAED,IAAI,yBAAyB,IAAI,MAAM,EAAE,CAMxC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blind_signing.d.ts","sourceRoot":"","sources":["../../../src/blind_signing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blind_signing.d.ts","sourceRoot":"","sources":["../../../src/blind_signing.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,UAAU,EACrB,QAAQ,EAAE,UAAU,EAAE,EACtB,OAAO,EAAE,MAAM,EAAE,EACjB,KAAK,EAAE,UAAU,EACjB,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC;IACT,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC,CAqBD;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,UAAU,EACtB,qBAAqB,EAAE,UAAU,EACjC,aAAa,EAAE,UAAU,EACzB,OAAO,EAAE,MAAM,EAAE,EACjB,KAAK,EAAE,UAAU,EACjB,iBAAiB,EAAE,MAAM,GACxB,OAAO,CAAC,OAAO,CAAC,CAgBlB;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,cAAc,EAAE,UAAU,EAC1B,cAAc,EAAE,UAAU,GACzB,OAAO,CAAC,UAAU,CAAC,CASrB"}
|
|
@@ -8,6 +8,8 @@ export { BbsBlsHolderBoundSignatureProof2022 } from './BbsBlsHolderBoundSignatur
|
|
|
8
8
|
export { JsonLd } from './JsonLd';
|
|
9
9
|
export { ldSign, ldVerify, ldDeriveProof, deriveProof, deriveProofHolderBound, } from './ld_signatures';
|
|
10
10
|
export { createCommitment, verifyCommitment, unblindSignature, } from './blind_signing';
|
|
11
|
+
export { JoseNamedCurve, JoseContentEncryption, JoseKeyEncryption, JoseSigningAlgorithm, generateJwk, generateKeyPair, joseEncrypt, joseDecrypt, generalEncryptJson, decryptJson, compactSignJson, compactJsonVerify, flattenedSignJson, jsonVerify, generalSignJson, } from './jose';
|
|
12
|
+
export type { JoseEncryptResult } from './jose';
|
|
11
13
|
export type { KeyPairOptions, GenerateKeyPairOptions, JsonWebKey, JwkKeyPairOptions, KeyPairSigner, KeyPairVerifier } from './types';
|
|
12
14
|
export type { BoundKeyPairOptions } from './BoundBls12381G2KeyPair';
|
|
13
15
|
export type { SignatureSuiteOptions, CreateProofOptions, VerifyProofOptions } from './BbsBlsSignature2020';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx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,YAAY,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAChG,YAAY,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AACrI,YAAY,EAAE,uBAAuB,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACrH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export declare enum JoseNamedCurve {
|
|
2
|
+
P256 = 0,
|
|
3
|
+
P384 = 1,
|
|
4
|
+
P521 = 2,
|
|
5
|
+
Secp256k1 = 3,
|
|
6
|
+
Ed25519 = 4,
|
|
7
|
+
Ed448 = 5,
|
|
8
|
+
X25519 = 6,
|
|
9
|
+
X448 = 7
|
|
10
|
+
}
|
|
11
|
+
export declare enum JoseContentEncryption {
|
|
12
|
+
A128gcm = 0,
|
|
13
|
+
A192gcm = 1,
|
|
14
|
+
A256gcm = 2,
|
|
15
|
+
A128cbcHs256 = 3,
|
|
16
|
+
A192cbcHs384 = 4,
|
|
17
|
+
A256cbcHs512 = 5
|
|
18
|
+
}
|
|
19
|
+
export declare enum JoseKeyEncryption {
|
|
20
|
+
Dir = 0,
|
|
21
|
+
EcdhEs = 1,
|
|
22
|
+
EcdhEsA128kw = 2,
|
|
23
|
+
EcdhEsA192kw = 3,
|
|
24
|
+
EcdhEsA256kw = 4,
|
|
25
|
+
Rsa1_5 = 5,
|
|
26
|
+
RsaOaep = 6,
|
|
27
|
+
RsaOaep256 = 7,
|
|
28
|
+
RsaOaep384 = 8,
|
|
29
|
+
RsaOaep512 = 9,
|
|
30
|
+
Pbes2Hs256A128kw = 10,
|
|
31
|
+
Pbes2Hs384A192kw = 11,
|
|
32
|
+
Pbes2Hs512A256kw = 12,
|
|
33
|
+
A128kw = 13,
|
|
34
|
+
A192kw = 14,
|
|
35
|
+
A256kw = 15,
|
|
36
|
+
A128gcmkw = 16,
|
|
37
|
+
A192gcmkw = 17,
|
|
38
|
+
A256gcmkw = 18
|
|
39
|
+
}
|
|
40
|
+
export declare enum JoseSigningAlgorithm {
|
|
41
|
+
Es256 = 0,
|
|
42
|
+
Es384 = 1,
|
|
43
|
+
Es512 = 2,
|
|
44
|
+
Es256k = 3,
|
|
45
|
+
Eddsa = 4,
|
|
46
|
+
Hs256 = 5,
|
|
47
|
+
Hs384 = 6,
|
|
48
|
+
Hs512 = 7,
|
|
49
|
+
Rs256 = 8,
|
|
50
|
+
Rs384 = 9,
|
|
51
|
+
Rs512 = 10,
|
|
52
|
+
Ps256 = 11,
|
|
53
|
+
Ps384 = 12,
|
|
54
|
+
Ps512 = 13
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generate a JWK key pair.
|
|
58
|
+
* Matches ffi-jose `generateJWK({ namedCurve })`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function generateJwk(namedCurve: JoseNamedCurve): Promise<any>;
|
|
61
|
+
/**
|
|
62
|
+
* Generate a full key pair (JWK, PEM, DER formats).
|
|
63
|
+
* Matches ffi-jose `generateKeyPair(type, { namedCurve })`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function generateKeyPair(namedCurve: JoseNamedCurve): Promise<any>;
|
|
66
|
+
export interface JoseEncryptResult {
|
|
67
|
+
ciphertext: string;
|
|
68
|
+
tag?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Low-level symmetric encryption. Key and IV as hex strings, plaintext as base64.
|
|
72
|
+
*/
|
|
73
|
+
export declare function joseEncrypt(enc: JoseContentEncryption, key: string, iv: string, message: string, aad?: string): Promise<JoseEncryptResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Low-level symmetric decryption. Returns base64-encoded plaintext.
|
|
76
|
+
*/
|
|
77
|
+
export declare function joseDecrypt(enc: JoseContentEncryption, key: string, iv: string, ciphertext: string, aad?: string, tag?: string): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Encrypt a JSON payload for one or more recipients using JWE General JSON serialization.
|
|
80
|
+
*/
|
|
81
|
+
export declare function generalEncryptJson(alg: JoseKeyEncryption, enc: JoseContentEncryption, payload: any, recipients: any[], didcomm?: boolean): Promise<any>;
|
|
82
|
+
/**
|
|
83
|
+
* Decrypt a JWE JSON object using a JWK private key.
|
|
84
|
+
*/
|
|
85
|
+
export declare function decryptJson(jwe: any, jwk: any): Promise<any>;
|
|
86
|
+
/**
|
|
87
|
+
* Sign a JSON payload using JWS Compact serialization.
|
|
88
|
+
*/
|
|
89
|
+
export declare function compactSignJson(alg: JoseSigningAlgorithm, payload: any, jwk: any, didcomm?: boolean): Promise<string>;
|
|
90
|
+
/**
|
|
91
|
+
* Verify a JWS Compact serialization and return the payload.
|
|
92
|
+
*/
|
|
93
|
+
export declare function compactJsonVerify(jws: string, jwk: any): Promise<any>;
|
|
94
|
+
/**
|
|
95
|
+
* Sign a JSON payload using JWS Flattened JSON serialization.
|
|
96
|
+
*/
|
|
97
|
+
export declare function flattenedSignJson(alg: JoseSigningAlgorithm, payload: any, jwk: any, didcomm?: boolean): Promise<any>;
|
|
98
|
+
/**
|
|
99
|
+
* Verify a JWS Flattened or General JSON serialization and return the payload.
|
|
100
|
+
*/
|
|
101
|
+
export declare function jsonVerify(jws: any, jwk: any): Promise<any>;
|
|
102
|
+
/**
|
|
103
|
+
* Sign a JSON payload using JWS General JSON serialization with multiple signers.
|
|
104
|
+
*/
|
|
105
|
+
export declare function generalSignJson(payload: any, jwks: any[], didcomm?: boolean): Promise<any>;
|
|
106
|
+
//# sourceMappingURL=jose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jose.d.ts","sourceRoot":"","sources":["../../../src/jose.ts"],"names":[],"mappings":"AAMA,oBAAY,cAAc;IACxB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,IAAI,IAAI;IACR,SAAS,IAAI;IACb,OAAO,IAAI;IACX,KAAK,IAAI;IACT,MAAM,IAAI;I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,GAAG,EAAE,EACX,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,GAAG,CAAC,CAMd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ld_signatures.d.ts","sourceRoot":"","sources":["../../../src/ld_signatures.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ld_signatures.d.ts","sourceRoot":"","sources":["../../../src/ld_signatures.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE;IACpC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE;QACP,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,GAAG,CAAC,CAGf;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,OAAO,EAAE;IACtC,QAAQ,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAGjD;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,QAAQ,EAAE,GAAG,CAAC;IACd,cAAc,EAAE,GAAG,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC,GAAG,OAAO,CAAC,GAAG,CAAC,CAGf;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,aAAa,EAAE,GAAG,EAClB,cAAc,EAAE,GAAG,EACnB,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1D,OAAO,CAAC,GAAG,CAAC,CAWd;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,GAAG,EAClB,cAAc,EAAE,GAAG,EACnB,OAAO,EAAE;IACP,cAAc,EAAE,UAAU,CAAC;IAC3B,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACA,OAAO,CAAC,GAAG,CAAC,CAad"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export declare const convertBase64urlToBase58: (value: string) => string;
|
|
2
|
+
export declare function toBase64(data: Uint8Array): string;
|
|
3
|
+
export declare function fromBase64(data: string): Uint8Array;
|
|
2
4
|
export declare function uint8ArrayToHexString(arr: Uint8Array): string;
|
|
3
5
|
//# sourceMappingURL=codec.d.ts.map
|
|
@@ -1 +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"}
|
|
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,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEjD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAEnD;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,UAAU,UAIpD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { convertBase64urlToBase58, uint8ArrayToHexString } from "./codec";
|
|
1
|
+
export { convertBase64urlToBase58, fromBase64, toBase64, uint8ArrayToHexString } from "./codec";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuggetslife/vc-rn",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "verifiable credential utils",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -70,7 +70,6 @@
|
|
|
70
70
|
"react-native": "0.74.2",
|
|
71
71
|
"react-native-builder-bob": "^0.20.0",
|
|
72
72
|
"release-it": "^15.0.0",
|
|
73
|
-
"turbo": "^1.10.7",
|
|
74
73
|
"typescript": "^5.2.2"
|
|
75
74
|
},
|
|
76
75
|
"resolutions": {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { vc_facade } from '.';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
function toBase64(data: Uint8Array): string {
|
|
5
|
-
return base64.stringify(data, { pad: true });
|
|
6
|
-
}
|
|
2
|
+
import { toBase64 } from './utils';
|
|
7
3
|
|
|
8
4
|
export interface BoundSignatureSuiteOptions {
|
|
9
5
|
key?: {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { vc_facade } from '.';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
function toBase64(data: Uint8Array): string {
|
|
5
|
-
return base64.stringify(data, { pad: true });
|
|
6
|
-
}
|
|
2
|
+
import { toBase64 } from './utils';
|
|
7
3
|
|
|
8
4
|
export interface BoundDeriveProofOptions {
|
|
9
5
|
document: any;
|
|
@@ -22,8 +18,6 @@ export interface BoundVerifyDerivedProofOptions {
|
|
|
22
18
|
export class BbsBlsHolderBoundSignatureProof2022 {
|
|
23
19
|
type = 'sec:BbsBlsHolderBoundSignatureProof2022';
|
|
24
20
|
|
|
25
|
-
constructor() {}
|
|
26
|
-
|
|
27
21
|
/**
|
|
28
22
|
* Derive a selective disclosure proof from a holder-bound signed document.
|
|
29
23
|
*/
|
package/src/Bls12381G2KeyPair.ts
CHANGED
|
@@ -239,9 +239,9 @@ export class Bls12381G2KeyPair {
|
|
|
239
239
|
controller,
|
|
240
240
|
fingerprint,
|
|
241
241
|
}: any): Bls12381G2KeyPair {
|
|
242
|
-
if (fingerprint.
|
|
242
|
+
if (fingerprint.slice(0, 1) != MULTIBASE_ENCODED_BASE58_IDENTIFIER) {
|
|
243
243
|
throw new Error(
|
|
244
|
-
`Unsupported fingerprint type: expected first character to be \`z\` indicating base58 encoding, received \`${fingerprint.
|
|
244
|
+
`Unsupported fingerprint type: expected first character to be \`z\` indicating base58 encoding, received \`${fingerprint.slice(
|
|
245
245
|
0,
|
|
246
246
|
1
|
|
247
247
|
)}\``
|
|
@@ -249,7 +249,7 @@ export class Bls12381G2KeyPair {
|
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
// parse of the multi-format public key removing the `z` that indicates base58 encoding
|
|
252
|
-
const buffer = bs58.decode(fingerprint.
|
|
252
|
+
const buffer = bs58.decode(fingerprint.slice(1));
|
|
253
253
|
|
|
254
254
|
if (buffer.length !== DEFAULT_BLS12381_G2_PUBLIC_KEY_LENGTH + 2) {
|
|
255
255
|
throw new Error(
|
package/src/blind_signing.ts
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import { vc_facade } from '.';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Convert a Uint8Array to a standard base64 string.
|
|
6
|
-
*/
|
|
7
|
-
function toBase64(data: Uint8Array): string {
|
|
8
|
-
return base64.stringify(data, { pad: true });
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Decode a standard base64 string to a Uint8Array.
|
|
13
|
-
*/
|
|
14
|
-
function fromBase64(data: string): Uint8Array {
|
|
15
|
-
return base64.parse(data, { loose: true });
|
|
16
|
-
}
|
|
2
|
+
import { fromBase64, toBase64 } from './utils';
|
|
17
3
|
|
|
18
4
|
/**
|
|
19
5
|
* Create a blind signature commitment (holder side).
|
package/src/index.tsx
CHANGED
|
@@ -52,6 +52,26 @@ export {
|
|
|
52
52
|
unblindSignature,
|
|
53
53
|
} from './blind_signing';
|
|
54
54
|
|
|
55
|
+
// JOSE operations
|
|
56
|
+
export {
|
|
57
|
+
JoseNamedCurve,
|
|
58
|
+
JoseContentEncryption,
|
|
59
|
+
JoseKeyEncryption,
|
|
60
|
+
JoseSigningAlgorithm,
|
|
61
|
+
generateJwk,
|
|
62
|
+
generateKeyPair,
|
|
63
|
+
joseEncrypt,
|
|
64
|
+
joseDecrypt,
|
|
65
|
+
generalEncryptJson,
|
|
66
|
+
decryptJson,
|
|
67
|
+
compactSignJson,
|
|
68
|
+
compactJsonVerify,
|
|
69
|
+
flattenedSignJson,
|
|
70
|
+
jsonVerify,
|
|
71
|
+
generalSignJson,
|
|
72
|
+
} from './jose';
|
|
73
|
+
export type { JoseEncryptResult } from './jose';
|
|
74
|
+
|
|
55
75
|
// Types
|
|
56
76
|
export type { KeyPairOptions, GenerateKeyPairOptions, JsonWebKey, JwkKeyPairOptions, KeyPairSigner, KeyPairVerifier } from './types';
|
|
57
77
|
export type { BoundKeyPairOptions } from './BoundBls12381G2KeyPair';
|
package/src/jose.ts
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { vc_facade } from '.';
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Enums — numeric values match NAPI JoseNamedCurve, JoseContentEncryption, etc.
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
export enum JoseNamedCurve {
|
|
8
|
+
P256 = 0,
|
|
9
|
+
P384 = 1,
|
|
10
|
+
P521 = 2,
|
|
11
|
+
Secp256k1 = 3,
|
|
12
|
+
Ed25519 = 4,
|
|
13
|
+
Ed448 = 5,
|
|
14
|
+
X25519 = 6,
|
|
15
|
+
X448 = 7,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum JoseContentEncryption {
|
|
19
|
+
A128gcm = 0,
|
|
20
|
+
A192gcm = 1,
|
|
21
|
+
A256gcm = 2,
|
|
22
|
+
A128cbcHs256 = 3,
|
|
23
|
+
A192cbcHs384 = 4,
|
|
24
|
+
A256cbcHs512 = 5,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export enum JoseKeyEncryption {
|
|
28
|
+
Dir = 0,
|
|
29
|
+
EcdhEs = 1,
|
|
30
|
+
EcdhEsA128kw = 2,
|
|
31
|
+
EcdhEsA192kw = 3,
|
|
32
|
+
EcdhEsA256kw = 4,
|
|
33
|
+
Rsa1_5 = 5,
|
|
34
|
+
RsaOaep = 6,
|
|
35
|
+
RsaOaep256 = 7,
|
|
36
|
+
RsaOaep384 = 8,
|
|
37
|
+
RsaOaep512 = 9,
|
|
38
|
+
Pbes2Hs256A128kw = 10,
|
|
39
|
+
Pbes2Hs384A192kw = 11,
|
|
40
|
+
Pbes2Hs512A256kw = 12,
|
|
41
|
+
A128kw = 13,
|
|
42
|
+
A192kw = 14,
|
|
43
|
+
A256kw = 15,
|
|
44
|
+
A128gcmkw = 16,
|
|
45
|
+
A192gcmkw = 17,
|
|
46
|
+
A256gcmkw = 18,
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export enum JoseSigningAlgorithm {
|
|
50
|
+
Es256 = 0,
|
|
51
|
+
Es384 = 1,
|
|
52
|
+
Es512 = 2,
|
|
53
|
+
Es256k = 3,
|
|
54
|
+
Eddsa = 4,
|
|
55
|
+
Hs256 = 5,
|
|
56
|
+
Hs384 = 6,
|
|
57
|
+
Hs512 = 7,
|
|
58
|
+
Rs256 = 8,
|
|
59
|
+
Rs384 = 9,
|
|
60
|
+
Rs512 = 10,
|
|
61
|
+
Ps256 = 11,
|
|
62
|
+
Ps384 = 12,
|
|
63
|
+
Ps512 = 13,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// Key Generation
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Generate a JWK key pair.
|
|
72
|
+
* Matches ffi-jose `generateJWK({ namedCurve })`.
|
|
73
|
+
*/
|
|
74
|
+
export async function generateJwk(
|
|
75
|
+
namedCurve: JoseNamedCurve
|
|
76
|
+
): Promise<any> {
|
|
77
|
+
const result = await vc_facade(
|
|
78
|
+
'jose_generate_jwk',
|
|
79
|
+
JSON.stringify({ namedCurve })
|
|
80
|
+
);
|
|
81
|
+
return JSON.parse(result);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Generate a full key pair (JWK, PEM, DER formats).
|
|
86
|
+
* Matches ffi-jose `generateKeyPair(type, { namedCurve })`.
|
|
87
|
+
*/
|
|
88
|
+
export async function generateKeyPair(
|
|
89
|
+
namedCurve: JoseNamedCurve
|
|
90
|
+
): Promise<any> {
|
|
91
|
+
const result = await vc_facade(
|
|
92
|
+
'jose_generate_key_pair',
|
|
93
|
+
JSON.stringify({ namedCurve })
|
|
94
|
+
);
|
|
95
|
+
return JSON.parse(result);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
// Symmetric Encrypt/Decrypt
|
|
100
|
+
// ---------------------------------------------------------------------------
|
|
101
|
+
|
|
102
|
+
export interface JoseEncryptResult {
|
|
103
|
+
ciphertext: string;
|
|
104
|
+
tag?: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Low-level symmetric encryption. Key and IV as hex strings, plaintext as base64.
|
|
109
|
+
*/
|
|
110
|
+
export async function joseEncrypt(
|
|
111
|
+
enc: JoseContentEncryption,
|
|
112
|
+
key: string,
|
|
113
|
+
iv: string,
|
|
114
|
+
message: string,
|
|
115
|
+
aad?: string
|
|
116
|
+
): Promise<JoseEncryptResult> {
|
|
117
|
+
const result = await vc_facade(
|
|
118
|
+
'jose_encrypt',
|
|
119
|
+
JSON.stringify({ enc, key, iv, message, aad: aad ?? '' })
|
|
120
|
+
);
|
|
121
|
+
return JSON.parse(result);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Low-level symmetric decryption. Returns base64-encoded plaintext.
|
|
126
|
+
*/
|
|
127
|
+
export async function joseDecrypt(
|
|
128
|
+
enc: JoseContentEncryption,
|
|
129
|
+
key: string,
|
|
130
|
+
iv: string,
|
|
131
|
+
ciphertext: string,
|
|
132
|
+
aad?: string,
|
|
133
|
+
tag?: string
|
|
134
|
+
): Promise<string> {
|
|
135
|
+
return vc_facade(
|
|
136
|
+
'jose_decrypt',
|
|
137
|
+
JSON.stringify({ enc, key, iv, ciphertext, aad: aad ?? '', tag })
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
// JWE — JSON Web Encryption
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Encrypt a JSON payload for one or more recipients using JWE General JSON serialization.
|
|
147
|
+
*/
|
|
148
|
+
export async function generalEncryptJson(
|
|
149
|
+
alg: JoseKeyEncryption,
|
|
150
|
+
enc: JoseContentEncryption,
|
|
151
|
+
payload: any,
|
|
152
|
+
recipients: any[],
|
|
153
|
+
didcomm?: boolean
|
|
154
|
+
): Promise<any> {
|
|
155
|
+
const result = await vc_facade(
|
|
156
|
+
'jose_general_encrypt_json',
|
|
157
|
+
JSON.stringify({ alg, enc, payload, recipients, didcomm })
|
|
158
|
+
);
|
|
159
|
+
return JSON.parse(result);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Decrypt a JWE JSON object using a JWK private key.
|
|
164
|
+
*/
|
|
165
|
+
export async function decryptJson(jwe: any, jwk: any): Promise<any> {
|
|
166
|
+
const result = await vc_facade(
|
|
167
|
+
'jose_decrypt_json',
|
|
168
|
+
JSON.stringify({ jwe, jwk })
|
|
169
|
+
);
|
|
170
|
+
return JSON.parse(result);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
// JWS — JSON Web Signature
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Sign a JSON payload using JWS Compact serialization.
|
|
179
|
+
*/
|
|
180
|
+
export async function compactSignJson(
|
|
181
|
+
alg: JoseSigningAlgorithm,
|
|
182
|
+
payload: any,
|
|
183
|
+
jwk: any,
|
|
184
|
+
didcomm?: boolean
|
|
185
|
+
): Promise<string> {
|
|
186
|
+
return vc_facade(
|
|
187
|
+
'jose_compact_sign_json',
|
|
188
|
+
JSON.stringify({ alg, payload, jwk, didcomm })
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Verify a JWS Compact serialization and return the payload.
|
|
194
|
+
*/
|
|
195
|
+
export async function compactJsonVerify(
|
|
196
|
+
jws: string,
|
|
197
|
+
jwk: any
|
|
198
|
+
): Promise<any> {
|
|
199
|
+
const result = await vc_facade(
|
|
200
|
+
'jose_compact_verify_json',
|
|
201
|
+
JSON.stringify({ jws, jwk })
|
|
202
|
+
);
|
|
203
|
+
return JSON.parse(result);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Sign a JSON payload using JWS Flattened JSON serialization.
|
|
208
|
+
*/
|
|
209
|
+
export async function flattenedSignJson(
|
|
210
|
+
alg: JoseSigningAlgorithm,
|
|
211
|
+
payload: any,
|
|
212
|
+
jwk: any,
|
|
213
|
+
didcomm?: boolean
|
|
214
|
+
): Promise<any> {
|
|
215
|
+
const result = await vc_facade(
|
|
216
|
+
'jose_flattened_sign_json',
|
|
217
|
+
JSON.stringify({ alg, payload, jwk, didcomm })
|
|
218
|
+
);
|
|
219
|
+
return JSON.parse(result);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Verify a JWS Flattened or General JSON serialization and return the payload.
|
|
224
|
+
*/
|
|
225
|
+
export async function jsonVerify(jws: any, jwk: any): Promise<any> {
|
|
226
|
+
const result = await vc_facade(
|
|
227
|
+
'jose_verify_json',
|
|
228
|
+
JSON.stringify({ jws, jwk })
|
|
229
|
+
);
|
|
230
|
+
return JSON.parse(result);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Sign a JSON payload using JWS General JSON serialization with multiple signers.
|
|
235
|
+
*/
|
|
236
|
+
export async function generalSignJson(
|
|
237
|
+
payload: any,
|
|
238
|
+
jwks: any[],
|
|
239
|
+
didcomm?: boolean
|
|
240
|
+
): Promise<any> {
|
|
241
|
+
const result = await vc_facade(
|
|
242
|
+
'jose_general_sign_json',
|
|
243
|
+
JSON.stringify({ payload, jwks, didcomm })
|
|
244
|
+
);
|
|
245
|
+
return JSON.parse(result);
|
|
246
|
+
}
|
package/src/ld_signatures.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { vc_facade } from '.';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Convert a Uint8Array to a standard base64 string.
|
|
6
|
-
*/
|
|
7
|
-
function toBase64(data: Uint8Array): string {
|
|
8
|
-
return base64.stringify(data, { pad: true });
|
|
9
|
-
}
|
|
2
|
+
import { toBase64 } from './utils';
|
|
10
3
|
|
|
11
4
|
/**
|
|
12
5
|
* Sign a document with BbsBlsSignature2020 and embed the proof.
|
package/src/utils/codec.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { base64url } from "rfc4648";
|
|
1
|
+
import { base64, base64url } from "rfc4648";
|
|
2
2
|
import bs58 from "bs58";
|
|
3
3
|
|
|
4
4
|
export const convertBase64urlToBase58 = (value: string): string => {
|
|
5
5
|
return bs58.encode(base64url.parse(value, { loose: true }));
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
export function toBase64(data: Uint8Array): string {
|
|
9
|
+
return base64.stringify(data, { pad: true });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function fromBase64(data: string): Uint8Array {
|
|
13
|
+
return base64.parse(data, { loose: true });
|
|
14
|
+
}
|
|
15
|
+
|
|
8
16
|
export function uint8ArrayToHexString(arr: Uint8Array) {
|
|
9
17
|
return Array.prototype.map.call(arr, function(byte) {
|
|
10
18
|
return ('0' + (byte & 0xFF).toString(16)).slice(-2);
|
package/src/utils/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { convertBase64urlToBase58, uint8ArrayToHexString } from "./codec";
|
|
1
|
+
export { convertBase64urlToBase58, fromBase64, toBase64, uint8ArrayToHexString } from "./codec";
|