@bsv/wallet-toolbox-client 1.1.62 → 1.2.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.
Files changed (71) hide show
  1. package/out/src/CWIStyleWalletManager.d.ts +417 -0
  2. package/out/src/CWIStyleWalletManager.d.ts.map +1 -0
  3. package/out/src/CWIStyleWalletManager.js +1140 -0
  4. package/out/src/CWIStyleWalletManager.js.map +1 -0
  5. package/out/src/SimpleWalletManager.d.ts +169 -0
  6. package/out/src/SimpleWalletManager.d.ts.map +1 -0
  7. package/out/src/SimpleWalletManager.js +315 -0
  8. package/out/src/SimpleWalletManager.js.map +1 -0
  9. package/out/src/Wallet.d.ts +6 -1
  10. package/out/src/Wallet.d.ts.map +1 -1
  11. package/out/src/Wallet.js +39 -7
  12. package/out/src/Wallet.js.map +1 -1
  13. package/out/src/WalletAuthenticationManager.d.ts +33 -0
  14. package/out/src/WalletAuthenticationManager.d.ts.map +1 -0
  15. package/out/src/WalletAuthenticationManager.js +110 -0
  16. package/out/src/WalletAuthenticationManager.js.map +1 -0
  17. package/out/src/WalletPermissionsManager.d.ts +575 -0
  18. package/out/src/WalletPermissionsManager.d.ts.map +1 -0
  19. package/out/src/WalletPermissionsManager.js +1789 -0
  20. package/out/src/WalletPermissionsManager.js.map +1 -0
  21. package/out/src/WalletSettingsManager.d.ts +59 -0
  22. package/out/src/WalletSettingsManager.d.ts.map +1 -0
  23. package/out/src/WalletSettingsManager.js +189 -0
  24. package/out/src/WalletSettingsManager.js.map +1 -0
  25. package/out/src/index.client.d.ts +9 -0
  26. package/out/src/index.client.d.ts.map +1 -1
  27. package/out/src/index.client.js +9 -0
  28. package/out/src/index.client.js.map +1 -1
  29. package/out/src/sdk/CertOpsWallet.d.ts +7 -0
  30. package/out/src/sdk/CertOpsWallet.d.ts.map +1 -0
  31. package/out/src/sdk/CertOpsWallet.js +3 -0
  32. package/out/src/sdk/CertOpsWallet.js.map +1 -0
  33. package/out/src/sdk/index.d.ts +1 -1
  34. package/out/src/sdk/index.d.ts.map +1 -1
  35. package/out/src/sdk/index.js +1 -1
  36. package/out/src/sdk/index.js.map +1 -1
  37. package/out/src/sdk/validationHelpers.d.ts.map +1 -1
  38. package/out/src/sdk/validationHelpers.js +13 -12
  39. package/out/src/sdk/validationHelpers.js.map +1 -1
  40. package/out/src/signer/methods/proveCertificate.d.ts.map +1 -1
  41. package/out/src/signer/methods/proveCertificate.js +3 -19
  42. package/out/src/signer/methods/proveCertificate.js.map +1 -1
  43. package/out/src/storage/remoting/StorageClient.d.ts +2 -2
  44. package/out/src/storage/remoting/StorageClient.d.ts.map +1 -1
  45. package/out/src/storage/remoting/StorageClient.js +1 -1
  46. package/out/src/storage/remoting/StorageClient.js.map +1 -1
  47. package/out/src/utility/identityUtils.d.ts +31 -0
  48. package/out/src/utility/identityUtils.d.ts.map +1 -0
  49. package/out/src/utility/identityUtils.js +116 -0
  50. package/out/src/utility/identityUtils.js.map +1 -0
  51. package/out/src/wab-client/WABClient.d.ts +49 -0
  52. package/out/src/wab-client/WABClient.d.ts.map +1 -0
  53. package/out/src/wab-client/WABClient.js +83 -0
  54. package/out/src/wab-client/WABClient.js.map +1 -0
  55. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts +34 -0
  56. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.d.ts.map +1 -0
  57. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js +16 -0
  58. package/out/src/wab-client/auth-method-interactors/AuthMethodInteractor.js.map +1 -0
  59. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts +7 -0
  60. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.d.ts.map +1 -0
  61. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js +36 -0
  62. package/out/src/wab-client/auth-method-interactors/PersonaIDInteractor.js.map +1 -0
  63. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts +28 -0
  64. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.d.ts.map +1 -0
  65. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js +69 -0
  66. package/out/src/wab-client/auth-method-interactors/TwilioPhoneInteractor.js.map +1 -0
  67. package/package.json +2 -2
  68. package/out/src/sdk/CertOps.d.ts +0 -66
  69. package/out/src/sdk/CertOps.d.ts.map +0 -1
  70. package/out/src/sdk/CertOps.js +0 -190
  71. package/out/src/sdk/CertOps.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersonaIDInteractor.d.ts","sourceRoot":"","sources":["../../../../../src/wab-client/auth-method-interactors/PersonaIDInteractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAEnH,qBAAa,mBAAoB,SAAQ,oBAAoB;IACpD,UAAU,SAAc;IAElB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAavG,YAAY,CACvB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,CAAC;CAYjC"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PersonaIDInteractor = void 0;
4
+ const AuthMethodInteractor_1 = require("./AuthMethodInteractor");
5
+ class PersonaIDInteractor extends AuthMethodInteractor_1.AuthMethodInteractor {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.methodType = 'PersonaID';
9
+ }
10
+ async startAuth(serverUrl, presentationKey, payload) {
11
+ const res = await fetch(`${serverUrl}/auth/start`, {
12
+ method: 'POST',
13
+ headers: { 'Content-Type': 'application/json' },
14
+ body: JSON.stringify({
15
+ methodType: this.methodType,
16
+ presentationKey,
17
+ payload
18
+ })
19
+ });
20
+ return res.json();
21
+ }
22
+ async completeAuth(serverUrl, presentationKey, payload) {
23
+ const res = await fetch(`${serverUrl}/auth/complete`, {
24
+ method: 'POST',
25
+ headers: { 'Content-Type': 'application/json' },
26
+ body: JSON.stringify({
27
+ methodType: this.methodType,
28
+ presentationKey,
29
+ payload
30
+ })
31
+ });
32
+ return res.json();
33
+ }
34
+ }
35
+ exports.PersonaIDInteractor = PersonaIDInteractor;
36
+ //# sourceMappingURL=PersonaIDInteractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PersonaIDInteractor.js","sourceRoot":"","sources":["../../../../../src/wab-client/auth-method-interactors/PersonaIDInteractor.ts"],"names":[],"mappings":";;;AAAA,iEAAmH;AAEnH,MAAa,mBAAoB,SAAQ,2CAAoB;IAA7D;;QACS,eAAU,GAAG,WAAW,CAAA;IA+BjC,CAAC;IA7BQ,KAAK,CAAC,SAAS,CAAC,SAAiB,EAAE,eAAuB,EAAE,OAAoB;QACrF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,SAAS,aAAa,EAAE;YACjD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,eAAe;gBACf,OAAO;aACR,CAAC;SACH,CAAC,CAAA;QACF,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;IACnB,CAAC;IAEM,KAAK,CAAC,YAAY,CACvB,SAAiB,EACjB,eAAuB,EACvB,OAAoB;QAEpB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,SAAS,gBAAgB,EAAE;YACpD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,eAAe;gBACf,OAAO;aACR,CAAC;SACH,CAAC,CAAA;QACF,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;IACnB,CAAC;CACF;AAhCD,kDAgCC"}
@@ -0,0 +1,28 @@
1
+ import { AuthMethodInteractor, AuthPayload, StartAuthResponse, CompleteAuthResponse } from './AuthMethodInteractor';
2
+ /**
3
+ * TwilioPhoneInteractor
4
+ *
5
+ * A client-side class that knows how to call the WAB server for Twilio-based phone verification.
6
+ */
7
+ export declare class TwilioPhoneInteractor extends AuthMethodInteractor {
8
+ methodType: string;
9
+ /**
10
+ * Start the Twilio phone verification on the server.
11
+ * - The server will send an SMS code to the user’s phone, using Twilio Verify.
12
+ * @param serverUrl - The base URL of the WAB server (e.g. http://localhost:3000)
13
+ * @param presentationKey - The 256-bit key the client is attempting to authenticate with
14
+ * @param payload - { phoneNumber: string } (the phone number to verify)
15
+ * @returns - { success, message, data }
16
+ */
17
+ startAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<StartAuthResponse>;
18
+ /**
19
+ * Complete the Twilio phone verification on the server.
20
+ * - The server will verify the code with Twilio Verify’s verificationChecks endpoint.
21
+ * @param serverUrl - The base URL of the WAB server
22
+ * @param presentationKey - The 256-bit key
23
+ * @param payload - { phoneNumber: string, otp: string } (the code that was received via SMS)
24
+ * @returns - { success, message, presentationKey }
25
+ */
26
+ completeAuth(serverUrl: string, presentationKey: string, payload: AuthPayload): Promise<CompleteAuthResponse>;
27
+ }
28
+ //# sourceMappingURL=TwilioPhoneInteractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TwilioPhoneInteractor.d.ts","sourceRoot":"","sources":["../../../../../src/wab-client/auth-method-interactors/TwilioPhoneInteractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAEnH;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,oBAAoB;IACtD,UAAU,SAAgB;IAEjC;;;;;;;OAOG;IACU,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAqBpH;;;;;;;OAOG;IACU,YAAY,CACvB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,CAAC;CAoBjC"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TwilioPhoneInteractor = void 0;
4
+ const AuthMethodInteractor_1 = require("./AuthMethodInteractor");
5
+ /**
6
+ * TwilioPhoneInteractor
7
+ *
8
+ * A client-side class that knows how to call the WAB server for Twilio-based phone verification.
9
+ */
10
+ class TwilioPhoneInteractor extends AuthMethodInteractor_1.AuthMethodInteractor {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.methodType = 'TwilioPhone';
14
+ }
15
+ /**
16
+ * Start the Twilio phone verification on the server.
17
+ * - The server will send an SMS code to the user’s phone, using Twilio Verify.
18
+ * @param serverUrl - The base URL of the WAB server (e.g. http://localhost:3000)
19
+ * @param presentationKey - The 256-bit key the client is attempting to authenticate with
20
+ * @param payload - { phoneNumber: string } (the phone number to verify)
21
+ * @returns - { success, message, data }
22
+ */
23
+ async startAuth(serverUrl, presentationKey, payload) {
24
+ const res = await fetch(`${serverUrl}/auth/start`, {
25
+ method: 'POST',
26
+ headers: { 'Content-Type': 'application/json' },
27
+ body: JSON.stringify({
28
+ methodType: this.methodType,
29
+ presentationKey,
30
+ payload
31
+ })
32
+ });
33
+ if (!res.ok) {
34
+ return {
35
+ success: false,
36
+ message: `HTTP error ${res.status}`
37
+ };
38
+ }
39
+ return res.json();
40
+ }
41
+ /**
42
+ * Complete the Twilio phone verification on the server.
43
+ * - The server will verify the code with Twilio Verify’s verificationChecks endpoint.
44
+ * @param serverUrl - The base URL of the WAB server
45
+ * @param presentationKey - The 256-bit key
46
+ * @param payload - { phoneNumber: string, otp: string } (the code that was received via SMS)
47
+ * @returns - { success, message, presentationKey }
48
+ */
49
+ async completeAuth(serverUrl, presentationKey, payload) {
50
+ const res = await fetch(`${serverUrl}/auth/complete`, {
51
+ method: 'POST',
52
+ headers: { 'Content-Type': 'application/json' },
53
+ body: JSON.stringify({
54
+ methodType: this.methodType,
55
+ presentationKey,
56
+ payload
57
+ })
58
+ });
59
+ if (!res.ok) {
60
+ return {
61
+ success: false,
62
+ message: `HTTP error ${res.status}`
63
+ };
64
+ }
65
+ return res.json();
66
+ }
67
+ }
68
+ exports.TwilioPhoneInteractor = TwilioPhoneInteractor;
69
+ //# sourceMappingURL=TwilioPhoneInteractor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TwilioPhoneInteractor.js","sourceRoot":"","sources":["../../../../../src/wab-client/auth-method-interactors/TwilioPhoneInteractor.ts"],"names":[],"mappings":";;;AAAA,iEAAmH;AAEnH;;;;GAIG;AACH,MAAa,qBAAsB,SAAQ,2CAAoB;IAA/D;;QACS,eAAU,GAAG,aAAa,CAAA;IA+DnC,CAAC;IA7DC;;;;;;;OAOG;IACI,KAAK,CAAC,SAAS,CAAC,SAAiB,EAAE,eAAuB,EAAE,OAAoB;QACrF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,SAAS,aAAa,EAAE;YACjD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,eAAe;gBACf,OAAO;aACR,CAAC;SACH,CAAC,CAAA;QAEF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,cAAc,GAAG,CAAC,MAAM,EAAE;aACpC,CAAA;QACH,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;IACnB,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,YAAY,CACvB,SAAiB,EACjB,eAAuB,EACvB,OAAoB;QAEpB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,SAAS,gBAAgB,EAAE;YACpD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;YAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACnB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,eAAe;gBACf,OAAO;aACR,CAAC;SACH,CAAC,CAAA;QAEF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,OAAO,EAAE,cAAc,GAAG,CAAC,MAAM,EAAE;aACpC,CAAA;QACH,CAAC;QAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;IACnB,CAAC;CACF;AAhED,sDAgEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/wallet-toolbox-client",
3
- "version": "1.1.62",
3
+ "version": "1.2.2",
4
4
  "description": "Client only Wallet Storage",
5
5
  "main": "./out/src/index.client.js",
6
6
  "types": "./out/src/index.client.d.ts",
@@ -20,7 +20,7 @@
20
20
  },
21
21
  "homepage": "https://github.com/bitcoin-sv/wallet-toolbox#readme",
22
22
  "dependencies": {
23
- "@bsv/sdk": "^1.3.35",
23
+ "@bsv/sdk": "^1.4.0",
24
24
  "axios": "^0.29.0"
25
25
  }
26
26
  }
@@ -1,66 +0,0 @@
1
- import { Base64String, Certificate as BsvCertificate, CertificateFieldNameUnder50Bytes, GetPublicKeyArgs, GetPublicKeyResult, OriginatorDomainNameStringUnder250Bytes, PubKeyHex, WalletCertificate, WalletDecryptArgs, WalletDecryptResult, WalletEncryptArgs, WalletEncryptResult, WalletProtocol } from '@bsv/sdk';
2
- export interface CertOpsWallet {
3
- getPublicKey(args: GetPublicKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetPublicKeyResult>;
4
- encrypt(args: WalletEncryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletEncryptResult>;
5
- decrypt(args: WalletDecryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletDecryptResult>;
6
- }
7
- export declare class CertOps extends BsvCertificate {
8
- wallet: CertOpsWallet;
9
- _keyring?: Record<CertificateFieldNameUnder50Bytes, string>;
10
- _encryptedFields?: Record<CertificateFieldNameUnder50Bytes, Base64String>;
11
- _decryptedFields?: Record<CertificateFieldNameUnder50Bytes, string>;
12
- constructor(wallet: CertOpsWallet, wc: WalletCertificate);
13
- static fromCounterparty(wallet: CertOpsWallet, e: {
14
- certificate: WalletCertificate;
15
- keyring: Record<CertificateFieldNameUnder50Bytes, string>;
16
- counterparty: PubKeyHex;
17
- }): Promise<CertOps>;
18
- static fromCertifier(wallet: CertOpsWallet, e: {
19
- certificate: WalletCertificate;
20
- keyring: Record<CertificateFieldNameUnder50Bytes, string>;
21
- }): Promise<CertOps>;
22
- static fromEncrypted(wallet: CertOpsWallet, wc: WalletCertificate, keyring: Record<CertificateFieldNameUnder50Bytes, string>): Promise<CertOps>;
23
- static fromDecrypted(wallet: CertOpsWallet, wc: WalletCertificate): Promise<CertOps>;
24
- static copyFields<T>(fields: Record<CertificateFieldNameUnder50Bytes, T>): Record<CertificateFieldNameUnder50Bytes, T>;
25
- static getProtocolForCertificateFieldEncryption(serialNumber: string, fieldName: string): {
26
- protocolID: WalletProtocol;
27
- keyID: string;
28
- };
29
- exportForSubject(): {
30
- certificate: WalletCertificate;
31
- keyring: Record<CertificateFieldNameUnder50Bytes, string>;
32
- };
33
- toWalletCertificate(): WalletCertificate;
34
- encryptFields(counterparty?: 'self' | PubKeyHex): Promise<{
35
- fields: Record<CertificateFieldNameUnder50Bytes, string>;
36
- keyring: Record<CertificateFieldNameUnder50Bytes, string>;
37
- }>;
38
- decryptFields(counterparty?: PubKeyHex, keyring?: Record<CertificateFieldNameUnder50Bytes, string>): Promise<Record<CertificateFieldNameUnder50Bytes, string>>;
39
- exportForCounterparty(
40
- /** The incoming counterparty is who they are to us. */
41
- counterparty: PubKeyHex, fieldsToReveal: CertificateFieldNameUnder50Bytes[]): Promise<{
42
- certificate: WalletCertificate;
43
- keyring: Record<CertificateFieldNameUnder50Bytes, string>;
44
- counterparty: PubKeyHex;
45
- }>;
46
- /**
47
- * Creates a verifiable certificate structure for a specific verifier, allowing them access to specified fields.
48
- * This method decrypts the master field keys for each field specified in `fieldsToReveal` and re-encrypts them
49
- * for the verifier's identity key. The resulting certificate structure includes only the fields intended to be
50
- * revealed and a verifier-specific keyring for field decryption.
51
- *
52
- * @param {PubKeyHex} verifierIdentityKey - The public identity key of the verifier who will receive access to the specified fields.
53
- * @param {CertificateFieldNameUnder50Bytes[]} fieldsToReveal - An array of field names to be revealed to the verifier. Must be a subset of the certificate's fields.
54
- * @returns {Promise<Record<CertificateFieldNameUnder50Bytes[], Base64String>} - A new certificate structure containing the original encrypted fields, the verifier-specific field decryption keyring, and essential certificate metadata.
55
- * @throws {WERR_INVALID_PARAMETER} Throws an error if:
56
- * - fieldsToReveal is empty or a field in `fieldsToReveal` does not exist in the certificate.
57
- * - The decrypted master field key fails to decrypt the corresponding field (indicating an invalid key).
58
- */
59
- createKeyringForVerifier(verifierIdentityKey: PubKeyHex, fieldsToReveal: CertificateFieldNameUnder50Bytes[]): Promise<Record<CertificateFieldNameUnder50Bytes, Base64String>>;
60
- /**
61
- * encrypt plaintext field values for the subject
62
- * update the signature using the certifier's private key.
63
- */
64
- encryptAndSignNewCertificate(): Promise<void>;
65
- }
66
- //# sourceMappingURL=CertOps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CertOps.d.ts","sourceRoot":"","sources":["../../../../src/sdk/CertOps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAA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AAiB,CAAA;QAC9B,OAAO,EAAE,MAAM,CAAC,gCAAgC,EAAE,MAAM,CAAC,CAAA;QACzD,YAAY,EAAE,SAAS,CAAA;KACxB,CAAC;IAaF;;;;;;;;;;;;OAYG;IACG,wBAAwB,CAC5B,mBAAmB,EAAE,SAAS,EAC9B,cAAc,EAAE,gCAAgC,EAAE,GACjD,OAAO,CAAC,MAAM,CAAC,gCAAgC,EAAE,YAAY,CAAC,CAAC;IAuClE;;;OAGG;IACG,4BAA4B,IAAI,OAAO,CAAC,IAAI,CAAC;CASpD"}
@@ -1,190 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CertOps = void 0;
4
- const sdk_1 = require("@bsv/sdk");
5
- const index_client_1 = require("../index.client");
6
- const sdk_2 = require("@bsv/sdk");
7
- const WERR_errors_1 = require("./WERR_errors");
8
- class CertOps extends sdk_1.Certificate {
9
- constructor(wallet, wc) {
10
- super(wc.type, wc.serialNumber, wc.subject, wc.certifier, wc.revocationOutpoint, wc.fields, wc.signature);
11
- this.wallet = wallet;
12
- }
13
- static async fromCounterparty(wallet, e) {
14
- const c = new CertOps(wallet, e.certificate);
15
- // confirm cert verifies and decrypts.
16
- await c.verify();
17
- await c.decryptFields(e.counterparty, e.keyring);
18
- // un-decrypt
19
- c.fields = c._encryptedFields;
20
- return c;
21
- }
22
- static async fromCertifier(wallet, e) {
23
- return await CertOps.fromCounterparty(wallet, {
24
- counterparty: e.certificate.certifier,
25
- ...e
26
- });
27
- }
28
- static async fromEncrypted(wallet, wc, keyring) {
29
- const c = new CertOps(wallet, wc);
30
- c._keyring = keyring;
31
- c._encryptedFields = this.copyFields(c.fields);
32
- c._decryptedFields = await c.decryptFields();
33
- await c.verify();
34
- return c;
35
- }
36
- static async fromDecrypted(wallet, wc) {
37
- const c = new CertOps(wallet, wc);
38
- ({ fields: c._encryptedFields, keyring: c._keyring } = await c.encryptFields());
39
- c._decryptedFields = await c.decryptFields();
40
- return c;
41
- }
42
- static copyFields(fields) {
43
- const copy = {};
44
- for (const [n, v] of Object.entries(fields))
45
- copy[n] = v;
46
- return copy;
47
- }
48
- static getProtocolForCertificateFieldEncryption(serialNumber, fieldName) {
49
- return {
50
- protocolID: [2, 'certificate field encryption'],
51
- keyID: `${serialNumber} ${fieldName}`
52
- };
53
- }
54
- exportForSubject() {
55
- if (!this._keyring || !this._encryptedFields || !this.signature || this.signature.length === 0)
56
- throw new WERR_errors_1.WERR_INVALID_OPERATION(`Certificate must be encrypted and signed prior to export.`);
57
- const certificate = this.toWalletCertificate();
58
- const keyring = this._keyring;
59
- return { certificate, keyring };
60
- }
61
- toWalletCertificate() {
62
- const wc = {
63
- signature: '',
64
- ...this
65
- };
66
- return wc;
67
- }
68
- async encryptFields(counterparty = 'self') {
69
- const fields = this._decryptedFields || this.fields;
70
- const encryptedFields = {};
71
- const keyring = {};
72
- for (const fieldName of Object.keys(fields)) {
73
- const fieldSymmetricKey = sdk_2.SymmetricKey.fromRandom();
74
- const encryptedFieldValue = fieldSymmetricKey.encrypt(sdk_2.Utils.toArray(this.fields[fieldName], 'utf8'));
75
- encryptedFields[fieldName] = sdk_2.Utils.toBase64(encryptedFieldValue);
76
- const encryptedFieldKey = await this.wallet.encrypt({
77
- plaintext: fieldSymmetricKey.toArray(),
78
- counterparty,
79
- ...CertOps.getProtocolForCertificateFieldEncryption(this.serialNumber, fieldName)
80
- });
81
- keyring[fieldName] = sdk_2.Utils.toBase64(encryptedFieldKey.ciphertext);
82
- }
83
- this._keyring = keyring;
84
- this._decryptedFields = fields;
85
- this.fields = this._encryptedFields = encryptedFields;
86
- return { fields: encryptedFields, keyring };
87
- }
88
- async decryptFields(counterparty, keyring) {
89
- keyring || (keyring = this._keyring);
90
- const fields = this._encryptedFields || this.fields;
91
- const decryptedFields = {};
92
- if (!keyring)
93
- throw new index_client_1.sdk.WERR_INVALID_PARAMETER('keyring', 'valid');
94
- try {
95
- for (const fieldName of Object.keys(keyring)) {
96
- const { plaintext: fieldRevelationKey } = await this.wallet.decrypt({
97
- ciphertext: sdk_2.Utils.toArray(keyring[fieldName], 'base64'),
98
- counterparty: counterparty || this.subject,
99
- ...CertOps.getProtocolForCertificateFieldEncryption(this.serialNumber, fieldName)
100
- });
101
- const fieldValue = new sdk_2.SymmetricKey(fieldRevelationKey).decrypt(sdk_2.Utils.toArray(fields[fieldName], 'base64'));
102
- decryptedFields[fieldName] = sdk_2.Utils.toUTF8(fieldValue);
103
- }
104
- this._keyring = keyring;
105
- this._encryptedFields = fields;
106
- this.fields = this._decryptedFields = decryptedFields;
107
- return decryptedFields;
108
- }
109
- catch (eu) {
110
- const e = index_client_1.sdk.WalletError.fromUnknown(eu);
111
- throw e;
112
- }
113
- }
114
- async exportForCounterparty(
115
- /** The incoming counterparty is who they are to us. */
116
- counterparty, fieldsToReveal) {
117
- if (!this._keyring || !this._encryptedFields || !this.signature || this.signature.length === 0)
118
- throw new WERR_errors_1.WERR_INVALID_OPERATION(`Certificate must be encrypted and signed prior to export.`);
119
- const certificate = this.toWalletCertificate();
120
- const keyring = await this.createKeyringForVerifier(counterparty, fieldsToReveal);
121
- // The exported counterparty is who we are to them...
122
- return {
123
- certificate,
124
- keyring,
125
- counterparty: await (0, index_client_1.getIdentityKey)(this.wallet)
126
- };
127
- }
128
- /**
129
- * Creates a verifiable certificate structure for a specific verifier, allowing them access to specified fields.
130
- * This method decrypts the master field keys for each field specified in `fieldsToReveal` and re-encrypts them
131
- * for the verifier's identity key. The resulting certificate structure includes only the fields intended to be
132
- * revealed and a verifier-specific keyring for field decryption.
133
- *
134
- * @param {PubKeyHex} verifierIdentityKey - The public identity key of the verifier who will receive access to the specified fields.
135
- * @param {CertificateFieldNameUnder50Bytes[]} fieldsToReveal - An array of field names to be revealed to the verifier. Must be a subset of the certificate's fields.
136
- * @returns {Promise<Record<CertificateFieldNameUnder50Bytes[], Base64String>} - A new certificate structure containing the original encrypted fields, the verifier-specific field decryption keyring, and essential certificate metadata.
137
- * @throws {WERR_INVALID_PARAMETER} Throws an error if:
138
- * - fieldsToReveal is empty or a field in `fieldsToReveal` does not exist in the certificate.
139
- * - The decrypted master field key fails to decrypt the corresponding field (indicating an invalid key).
140
- */
141
- async createKeyringForVerifier(verifierIdentityKey, fieldsToReveal) {
142
- if (!this._keyring || !this._encryptedFields)
143
- throw new index_client_1.sdk.WERR_INVALID_OPERATION(`certificate must be encrypted`);
144
- if (!Array.isArray(fieldsToReveal) || fieldsToReveal.some(n => this._encryptedFields[n] === undefined))
145
- throw new index_client_1.sdk.WERR_INVALID_PARAMETER('fieldsToReveal', `an array of certificate field names`);
146
- const fieldRevelationKeyring = {};
147
- for (const fieldName of fieldsToReveal) {
148
- // Create a keyID
149
- const encryptedFieldKey = this._keyring[fieldName];
150
- const protocol = CertOps.getProtocolForCertificateFieldEncryption(this.serialNumber, fieldName);
151
- // Decrypt the master field key
152
- const { plaintext: fieldKey } = await this.wallet.decrypt({
153
- ciphertext: sdk_2.Utils.toArray(encryptedFieldKey, 'base64'),
154
- counterparty: this.certifier,
155
- ...protocol
156
- });
157
- // Verify that derived key actually decrypts requested field
158
- try {
159
- new sdk_2.SymmetricKey(fieldKey).decrypt(sdk_2.Utils.toArray(this.fields[fieldName], 'base64'));
160
- }
161
- catch (_) {
162
- throw new index_client_1.sdk.WERR_INTERNAL(`unable to decrypt field "${fieldName}" using derived field key.`);
163
- }
164
- // Encrypt derived fieldRevelationKey for verifier
165
- const { ciphertext: encryptedFieldRevelationKey } = await this.wallet.encrypt({
166
- plaintext: fieldKey,
167
- counterparty: verifierIdentityKey,
168
- ...protocol
169
- });
170
- // Add encryptedFieldRevelationKey to fieldRevelationKeyring
171
- fieldRevelationKeyring[fieldName] = sdk_2.Utils.toBase64(encryptedFieldRevelationKey);
172
- }
173
- // Return the field revelation keyring which can be used to create a verifiable certificate for a verifier.
174
- return fieldRevelationKeyring;
175
- }
176
- /**
177
- * encrypt plaintext field values for the subject
178
- * update the signature using the certifier's private key.
179
- */
180
- async encryptAndSignNewCertificate() {
181
- if ((await (0, index_client_1.getIdentityKey)(this.wallet)) !== this.certifier)
182
- throw new index_client_1.sdk.WERR_INVALID_PARAMETER('wallet', 'the certifier for new certificate issuance.');
183
- await this.encryptFields(this.subject);
184
- await this.sign(this.wallet);
185
- // Confirm the signed certificate verifies:
186
- await this.verify();
187
- }
188
- }
189
- exports.CertOps = CertOps;
190
- //# sourceMappingURL=CertOps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CertOps.js","sourceRoot":"","sources":["../../../../src/sdk/CertOps.ts"],"names":[],"mappings":";;;AAAA,kCAeiB;AACjB,kDAAqD;AACrD,kCAA8C;AAC9C,+CAAsD;AAWtD,MAAa,OAAQ,SAAQ,iBAAc;IAKzC,YACS,MAAqB,EAC5B,EAAqB;QAErB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,kBAAkB,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,CAAA;QAHlG,WAAM,GAAN,MAAM,CAAe;IAI9B,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAC3B,MAAqB,EACrB,CAIC;QAED,MAAM,CAAC,GAAG,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,CAAA;QAC5C,sCAAsC;QACtC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAA;QAChB,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;QAChD,aAAa;QACb,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,gBAAiB,CAAA;QAC9B,OAAO,CAAC,CAAA;IACV,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,aAAa,CACxB,MAAqB,EACrB,CAGC;QAED,OAAO,MAAM,OAAO,CAAC,gBAAgB,CAAC,MAAM,EAAE;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