@notabene/javascript-sdk 2.8.0 → 2.9.0-next.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.
- package/dist/cjs/notabene.cjs +1 -1
- package/dist/cjs/notabene.d.ts +19 -3
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +19 -3
- package/dist/esm/notabene.js +114 -88
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +19 -3
- package/dist/notabene.js +114 -88
- package/docs/README.md +4 -4
- package/docs/_media/TransactionOptions.md +6 -6
- package/docs/ivms/types/enumerations/PayloadVersionCode.md +2 -2
- package/docs/ivms/types/interfaces/PayloadMetadata.md +2 -2
- package/docs/ivms/types/type-aliases/Address.md +1 -1
- package/docs/ivms/types/type-aliases/AddressTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/Beneficiary.md +1 -1
- package/docs/ivms/types/type-aliases/BeneficiaryVASP.md +1 -1
- package/docs/ivms/types/type-aliases/DateAndPlaceOfBirth.md +1 -1
- package/docs/ivms/types/type-aliases/ISOCountryCode.md +1 -1
- package/docs/ivms/types/type-aliases/ISODate.md +1 -1
- package/docs/ivms/types/type-aliases/IVMS101.md +1 -1
- package/docs/ivms/types/type-aliases/IntermediaryVASP.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPerson.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPersonName.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/LegalPersonNameTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/LocalLegalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/LocalNaturalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/NationalIdentification.md +1 -1
- package/docs/ivms/types/type-aliases/NationalIdentifierTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPerson.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPersonName.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPersonNameID.md +1 -1
- package/docs/ivms/types/type-aliases/NaturalPersonNameTypeCode.md +1 -1
- package/docs/ivms/types/type-aliases/OriginatingVASP.md +1 -1
- package/docs/ivms/types/type-aliases/Originator.md +1 -1
- package/docs/ivms/types/type-aliases/Person.md +1 -1
- package/docs/ivms/types/type-aliases/TransferPath.md +1 -1
- package/docs/ivms/types/type-aliases/TransliterationMethodCode.md +1 -1
- package/docs/notabene/classes/ConnectionManager.md +5 -5
- package/docs/notabene/classes/EmbeddedComponent.md +17 -17
- package/docs/notabene/classes/default.md +7 -7
- package/docs/notabene/functions/decodeFragmentToObject.md +1 -1
- package/docs/notabene/interfaces/ConnectionData.md +3 -3
- package/docs/notabene/interfaces/ConnectionMetadata.md +3 -3
- package/docs/notabene/interfaces/ConnectionResponse.md +5 -5
- package/docs/notabene/interfaces/NotabeneConfig.md +5 -5
- package/docs/notabene/type-aliases/MessageCallback.md +1 -1
- package/docs/notabene/type-aliases/TransactionType.md +1 -1
- package/docs/types/enumerations/AgentType.md +2 -2
- package/docs/types/enumerations/CMType.md +7 -7
- package/docs/types/enumerations/ErrorIdentifierCode.md +4 -4
- package/docs/types/enumerations/HMType.md +2 -2
- package/docs/types/enumerations/PersonType.md +3 -3
- package/docs/types/enumerations/ProofStatus.md +4 -4
- package/docs/types/enumerations/ProofTypes.md +27 -16
- package/docs/types/enumerations/Status.md +5 -5
- package/docs/types/enumerations/VASPSearchControl.md +2 -2
- package/docs/types/enumerations/ValidationSections.md +4 -4
- package/docs/types/interfaces/Agent.md +6 -6
- package/docs/types/interfaces/CallbackOptions.md +2 -2
- package/docs/types/interfaces/ComponentRequest.md +2 -2
- package/docs/types/interfaces/ComponentResponse.md +4 -4
- package/docs/types/interfaces/ConnectionRecord.md +7 -7
- package/docs/types/interfaces/ConnectionRequest.md +3 -3
- package/docs/types/interfaces/Counterparty.md +10 -10
- package/docs/types/interfaces/DeclarationProof.md +6 -6
- package/docs/types/interfaces/Deposit.md +11 -11
- package/docs/types/interfaces/DepositRequest.md +7 -7
- package/docs/types/interfaces/DepositRequestOptions.md +1 -1
- package/docs/types/interfaces/DepositTransaction.md +9 -9
- package/docs/types/interfaces/LegalPerson.md +13 -13
- package/docs/types/interfaces/MicroTransferProof.md +9 -9
- package/docs/types/interfaces/NaturalPerson.md +13 -13
- package/docs/types/interfaces/OwnershipProof.md +4 -4
- package/docs/types/interfaces/RefreshSource.md +2 -2
- package/docs/types/interfaces/Refreshable.md +1 -1
- package/docs/types/interfaces/ScreenshotProof.md +5 -5
- package/docs/types/interfaces/SignatureProof.md +10 -10
- package/docs/types/interfaces/ThresholdOptions.md +3 -3
- package/docs/types/interfaces/Transaction.md +8 -8
- package/docs/types/interfaces/TransactionOptions.md +6 -6
- package/docs/types/interfaces/TransactionResponse.md +9 -9
- package/docs/types/interfaces/VASP.md +9 -9
- package/docs/types/interfaces/Wallet.md +8 -8
- package/docs/types/interfaces/Withdrawal.md +10 -10
- package/docs/types/type-aliases/BlockchainAddress.md +1 -1
- package/docs/types/type-aliases/CAIP10.md +1 -1
- package/docs/types/type-aliases/CAIP19.md +1 -1
- package/docs/types/type-aliases/CAIP2.md +1 -1
- package/docs/types/type-aliases/CAIP220.md +1 -1
- package/docs/types/type-aliases/Cancel.md +1 -1
- package/docs/types/type-aliases/Completed.md +1 -1
- package/docs/types/type-aliases/ComponentMessage.md +1 -1
- package/docs/types/type-aliases/ConnectionOptions.md +1 -1
- package/docs/types/type-aliases/CryptoCredential.md +1 -1
- package/docs/types/type-aliases/DID.md +1 -1
- package/docs/types/type-aliases/DTI.md +1 -1
- package/docs/types/type-aliases/Destination.md +1 -1
- package/docs/types/type-aliases/Error.md +1 -1
- package/docs/types/type-aliases/FieldOptions.md +1 -1
- package/docs/types/type-aliases/FieldTypes.md +1 -1
- package/docs/types/type-aliases/HostMessage.md +1 -1
- package/docs/types/type-aliases/ISOCurrency.md +1 -1
- package/docs/types/type-aliases/InvalidValue.md +1 -1
- package/docs/types/type-aliases/LEI.md +1 -1
- package/docs/types/type-aliases/LegalPersonFieldName.md +1 -1
- package/docs/types/type-aliases/LegalPersonFields.md +1 -1
- package/docs/types/type-aliases/NationalIdentifierTypeFieldOptions.md +1 -1
- package/docs/types/type-aliases/NaturalPersonFieldName.md +1 -1
- package/docs/types/type-aliases/NaturalPersonFields.md +1 -1
- package/docs/types/type-aliases/NotabeneAsset.md +1 -1
- package/docs/types/type-aliases/Ready.md +1 -1
- package/docs/types/type-aliases/ResizeRequest.md +1 -1
- package/docs/types/type-aliases/Source.md +1 -1
- package/docs/types/type-aliases/Theme.md +1 -1
- package/docs/types/type-aliases/TransactionAsset.md +1 -1
- package/docs/types/type-aliases/TravelAddress.md +1 -1
- package/docs/types/type-aliases/URI.md +1 -1
- package/docs/types/type-aliases/UUID.md +1 -1
- package/docs/types/type-aliases/UpdateValue.md +1 -1
- package/docs/types/type-aliases/V1Asset.md +1 -1
- package/docs/types/type-aliases/V1Transaction.md +1 -1
- package/docs/types/type-aliases/VASPOptions.md +1 -1
- package/docs/types/type-aliases/ValidationError.md +1 -1
- package/package.json +1 -1
- package/src/notabene.ts +5 -0
- package/src/types.ts +4 -1
- package/src/utils/__tests__/connections.test.ts +24 -7
- package/src/utils/connections.ts +60 -2
- package/src/utils/encryption.ts +5 -3
|
@@ -12,4 +12,4 @@ A crypto credential
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:192](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:192](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L192)
|
|
@@ -12,4 +12,4 @@ A Decentralized Identifier
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:220](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:220](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L220)
|
|
@@ -35,4 +35,4 @@ Format: `DTI[NNNNN]` where N is a digit
|
|
|
35
35
|
|
|
36
36
|
## Defined in
|
|
37
37
|
|
|
38
|
-
[types.ts:118](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
38
|
+
[types.ts:118](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L118)
|
|
@@ -12,4 +12,4 @@ The destination of a transaction either a blockchain address, a CAIP-19 address,
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:198](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:198](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L198)
|
|
@@ -42,4 +42,4 @@ Identifier code of the error message
|
|
|
42
42
|
|
|
43
43
|
## Defined in
|
|
44
44
|
|
|
45
|
-
[types.ts:902](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
45
|
+
[types.ts:902](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L902)
|
|
@@ -12,4 +12,4 @@ Field properties
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:742](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:742](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L742)
|
|
@@ -22,4 +22,4 @@ Field type configuration
|
|
|
22
22
|
|
|
23
23
|
## Defined in
|
|
24
24
|
|
|
25
|
-
[types.ts:755](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
25
|
+
[types.ts:755](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L755)
|
|
@@ -34,4 +34,4 @@ without requiring full reinitialization.
|
|
|
34
34
|
|
|
35
35
|
## Defined in
|
|
36
36
|
|
|
37
|
-
[types.ts:1014](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
37
|
+
[types.ts:1014](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L1014)
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:232](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:232](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L232)
|
|
@@ -42,4 +42,4 @@ Array of validation errors
|
|
|
42
42
|
|
|
43
43
|
## Defined in
|
|
44
44
|
|
|
45
|
-
[types.ts:924](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
45
|
+
[types.ts:924](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L924)
|
|
@@ -12,4 +12,4 @@ A LEI Legal Entity Identifier
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:226](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:226](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L226)
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
|
|
11
11
|
## Defined in
|
|
12
12
|
|
|
13
|
-
[types.ts:449](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
13
|
+
[types.ts:449](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L449)
|
|
@@ -12,4 +12,4 @@ Field properties for legal person fields
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:463](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:463](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L463)
|
|
@@ -18,4 +18,4 @@ Field properties for national identifier type selection
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[types.ts:399](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
21
|
+
[types.ts:399](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L399)
|
|
@@ -12,4 +12,4 @@ Field names for NaturalPerson
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:384](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:384](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L384)
|
|
@@ -12,4 +12,4 @@ Field properties for natural person fields
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:407](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:407](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L407)
|
|
@@ -33,4 +33,4 @@ system that may be used alongside CAIP-19 and DTI identifiers.
|
|
|
33
33
|
|
|
34
34
|
## Defined in
|
|
35
35
|
|
|
36
|
-
[types.ts:140](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
36
|
+
[types.ts:140](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L140)
|
|
@@ -18,4 +18,4 @@ Represents a ready component message
|
|
|
18
18
|
|
|
19
19
|
## Defined in
|
|
20
20
|
|
|
21
|
-
[types.ts:871](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
21
|
+
[types.ts:871](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L871)
|
|
@@ -24,4 +24,4 @@ Represents a resize request component message. This is handled by the library.
|
|
|
24
24
|
|
|
25
25
|
## Defined in
|
|
26
26
|
|
|
27
|
-
[types.ts:879](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
27
|
+
[types.ts:879](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L879)
|
|
@@ -12,4 +12,4 @@ The source of a transaction
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:208](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:208](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L208)
|
|
@@ -34,4 +34,4 @@ The theme of the Notabene SDK
|
|
|
34
34
|
|
|
35
35
|
## Defined in
|
|
36
36
|
|
|
37
|
-
[types.ts:238](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
37
|
+
[types.ts:238](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L238)
|
|
@@ -12,4 +12,4 @@ The asset of a transaction either a Notabene asset, a CAIP-19 asset, or a DTI.
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:146](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:146](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L146)
|
|
@@ -34,4 +34,4 @@ VASPs and blockchain networks while maintaining privacy.
|
|
|
34
34
|
|
|
35
35
|
## Defined in
|
|
36
36
|
|
|
37
|
-
[types.ts:187](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
37
|
+
[types.ts:187](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L187)
|
|
@@ -12,4 +12,4 @@ A Uniform Resource Identifier
|
|
|
12
12
|
|
|
13
13
|
## Defined in
|
|
14
14
|
|
|
15
|
-
[types.ts:214](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
15
|
+
[types.ts:214](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L214)
|
|
@@ -24,4 +24,4 @@ Format: 8-4-4-4-12 hexadecimal digits
|
|
|
24
24
|
|
|
25
25
|
## Defined in
|
|
26
26
|
|
|
27
|
-
[types.ts:40](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
27
|
+
[types.ts:40](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L40)
|
|
@@ -51,4 +51,4 @@ and its configuration without requiring a full reload/reinitialize.
|
|
|
51
51
|
|
|
52
52
|
## Defined in
|
|
53
53
|
|
|
54
|
-
[types.ts:992](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
54
|
+
[types.ts:992](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L992)
|
|
@@ -33,4 +33,4 @@ Used for backwards compatibility with V1 API transaction payloads:
|
|
|
33
33
|
|
|
34
34
|
## Defined in
|
|
35
35
|
|
|
36
|
-
[types.ts:657](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
36
|
+
[types.ts:657](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L657)
|
|
@@ -54,4 +54,4 @@ Transaction payload suitable for calling Notabene v1 tx/create
|
|
|
54
54
|
|
|
55
55
|
## Defined in
|
|
56
56
|
|
|
57
|
-
[types.ts:663](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
57
|
+
[types.ts:663](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L663)
|
|
@@ -26,4 +26,4 @@ Options for which VASPs to be searchable
|
|
|
26
26
|
|
|
27
27
|
## Defined in
|
|
28
28
|
|
|
29
|
-
[types.ts:777](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
29
|
+
[types.ts:777](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L777)
|
|
@@ -22,4 +22,4 @@ Validation error
|
|
|
22
22
|
|
|
23
23
|
## Defined in
|
|
24
24
|
|
|
25
|
-
[types.ts:733](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/
|
|
25
|
+
[types.ts:733](https://gitlab.com/notabene/open-source/javascript-sdk/-/blob/69cd8d08514af027712db73539fbd0247649c123/src/types.ts#L733)
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.
|
|
13
|
+
"version": "2.9.0-next.2",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/src/notabene.ts
CHANGED
|
@@ -39,6 +39,7 @@ import type {
|
|
|
39
39
|
NotabeneAsset,
|
|
40
40
|
OwnershipProof,
|
|
41
41
|
Ready,
|
|
42
|
+
RefreshSource,
|
|
42
43
|
ResizeRequest,
|
|
43
44
|
ScreenshotProof,
|
|
44
45
|
SignatureProof,
|
|
@@ -75,9 +76,12 @@ import { decodeFragmentToObject, encodeObjectToFragment } from './utils/urls';
|
|
|
75
76
|
export { default as EmbeddedComponent } from './components/EmbeddedComponent';
|
|
76
77
|
export {
|
|
77
78
|
ConnectionManager,
|
|
79
|
+
getRefreshResult,
|
|
78
80
|
type ConnectionData,
|
|
79
81
|
type ConnectionMetadata,
|
|
80
82
|
type ConnectionResponse,
|
|
83
|
+
type ConnectionResult,
|
|
84
|
+
type ConnectionStatus,
|
|
81
85
|
type TransactionType,
|
|
82
86
|
} from './utils/connections';
|
|
83
87
|
export {
|
|
@@ -134,6 +138,7 @@ export type {
|
|
|
134
138
|
NotabeneAsset,
|
|
135
139
|
OwnershipProof,
|
|
136
140
|
Ready,
|
|
141
|
+
RefreshSource,
|
|
137
142
|
ResizeRequest,
|
|
138
143
|
ScreenshotProof,
|
|
139
144
|
SignatureProof,
|
package/src/types.ts
CHANGED
|
@@ -1055,6 +1055,7 @@ export enum ProofStatus {
|
|
|
1055
1055
|
* - TIP191: Tron message signing
|
|
1056
1056
|
* - ED25519: Ed25519 signature (used in Solana)
|
|
1057
1057
|
* - XRP_ED25519: Ed25519 signature (used in XRP)
|
|
1058
|
+
* - XLM_ED25519: Ed25519 signature (used in Stellar)
|
|
1058
1059
|
* - XPUB: Extended public key signature for HD wallets
|
|
1059
1060
|
* - MicroTransfer: Proof via small blockchain transaction
|
|
1060
1061
|
* - Screenshot: Image proof of ownership/access
|
|
@@ -1079,6 +1080,7 @@ export enum ProofTypes {
|
|
|
1079
1080
|
TIP191 = 'tip-191',
|
|
1080
1081
|
ED25519 = 'ed25519',
|
|
1081
1082
|
XRP_ED25519 = 'xrp-ed25519',
|
|
1083
|
+
XLM_ED25519 = 'xlm-ed25519',
|
|
1082
1084
|
CIP8 = 'cip-8',
|
|
1083
1085
|
MicroTransfer = 'microtransfer',
|
|
1084
1086
|
Screenshot = 'screenshot',
|
|
@@ -1143,7 +1145,8 @@ export interface SignatureProof extends OwnershipProof {
|
|
|
1143
1145
|
| ProofTypes.SIWX
|
|
1144
1146
|
| ProofTypes.SIWE
|
|
1145
1147
|
| ProofTypes.CIP8
|
|
1146
|
-
| ProofTypes.XRP_ED25519
|
|
1148
|
+
| ProofTypes.XRP_ED25519
|
|
1149
|
+
| ProofTypes.XLM_ED25519;
|
|
1147
1150
|
|
|
1148
1151
|
proof: string;
|
|
1149
1152
|
attestation: string;
|
|
@@ -68,6 +68,7 @@ describe('ConnectionManager', () => {
|
|
|
68
68
|
const mockResponse = {
|
|
69
69
|
id: 'test-id',
|
|
70
70
|
version: 1,
|
|
71
|
+
status: 'active',
|
|
71
72
|
metadata,
|
|
72
73
|
sealed: ['encrypted-data'],
|
|
73
74
|
};
|
|
@@ -92,6 +93,7 @@ describe('ConnectionManager', () => {
|
|
|
92
93
|
expect(result).toEqual({
|
|
93
94
|
id: mockResponse.id,
|
|
94
95
|
metadata: mockResponse.metadata,
|
|
96
|
+
status: mockResponse.status,
|
|
95
97
|
version: mockResponse.version,
|
|
96
98
|
data: request,
|
|
97
99
|
key: expect.any(String),
|
|
@@ -124,6 +126,9 @@ describe('ConnectionManager', () => {
|
|
|
124
126
|
|
|
125
127
|
describe('update', () => {
|
|
126
128
|
it('should successfully update an existing connection', async () => {
|
|
129
|
+
const testData = { requestId: 'test-123' };
|
|
130
|
+
const sealed = await seal(testData);
|
|
131
|
+
|
|
127
132
|
await fc.assert(
|
|
128
133
|
fc.asyncProperty(
|
|
129
134
|
fc.uuid(),
|
|
@@ -134,8 +139,9 @@ describe('ConnectionManager', () => {
|
|
|
134
139
|
const mockResponse = {
|
|
135
140
|
id,
|
|
136
141
|
metadata: arbConnectionMetadata,
|
|
142
|
+
status: 'completed',
|
|
137
143
|
version: version + 1,
|
|
138
|
-
sealed: [
|
|
144
|
+
sealed: [sealed.ciphertext],
|
|
139
145
|
};
|
|
140
146
|
|
|
141
147
|
fetchMock.mockResolvedValueOnce({
|
|
@@ -143,7 +149,13 @@ describe('ConnectionManager', () => {
|
|
|
143
149
|
json: async () => mockResponse,
|
|
144
150
|
});
|
|
145
151
|
|
|
146
|
-
const result = await manager.update(
|
|
152
|
+
const result = await manager.update(
|
|
153
|
+
id,
|
|
154
|
+
request,
|
|
155
|
+
version,
|
|
156
|
+
'completed',
|
|
157
|
+
sealed.key,
|
|
158
|
+
);
|
|
147
159
|
|
|
148
160
|
// Verify fetch was called correctly
|
|
149
161
|
expect(fetchMock).toHaveBeenCalledWith(`${testEndpoint}/${id}`, {
|
|
@@ -158,16 +170,19 @@ describe('ConnectionManager', () => {
|
|
|
158
170
|
expect(result).toEqual({
|
|
159
171
|
id: mockResponse.id,
|
|
160
172
|
version: mockResponse.version,
|
|
173
|
+
status: mockResponse.status,
|
|
161
174
|
metadata: mockResponse.metadata,
|
|
162
175
|
data: request,
|
|
163
|
-
key:
|
|
176
|
+
key: sealed.key,
|
|
164
177
|
});
|
|
165
178
|
},
|
|
166
179
|
),
|
|
167
180
|
);
|
|
168
181
|
});
|
|
169
182
|
|
|
170
|
-
it('should throw error on failed update', async () => {
|
|
183
|
+
it('should throw error on failed update due to invalid key', async () => {
|
|
184
|
+
const { key: newKey } = await seal('testData');
|
|
185
|
+
|
|
171
186
|
await fc.assert(
|
|
172
187
|
fc.asyncProperty(
|
|
173
188
|
fc.uuid(),
|
|
@@ -180,9 +195,9 @@ describe('ConnectionManager', () => {
|
|
|
180
195
|
text: async () => 'Update failed',
|
|
181
196
|
});
|
|
182
197
|
|
|
183
|
-
await expect(
|
|
184
|
-
|
|
185
|
-
);
|
|
198
|
+
await expect(
|
|
199
|
+
manager.update(id, request, version, 'active', newKey),
|
|
200
|
+
).rejects.toThrow('Failed to update connection');
|
|
186
201
|
},
|
|
187
202
|
),
|
|
188
203
|
);
|
|
@@ -201,6 +216,7 @@ describe('ConnectionManager', () => {
|
|
|
201
216
|
const mockResponse = {
|
|
202
217
|
id,
|
|
203
218
|
version: 1,
|
|
219
|
+
status: 'active',
|
|
204
220
|
metadata: arbConnectionMetadata,
|
|
205
221
|
sealed: [sealed.ciphertext], // Use the real ciphertext
|
|
206
222
|
};
|
|
@@ -221,6 +237,7 @@ describe('ConnectionManager', () => {
|
|
|
221
237
|
expect(result).toEqual({
|
|
222
238
|
id: mockResponse.id,
|
|
223
239
|
version: mockResponse.version,
|
|
240
|
+
status: mockResponse.status,
|
|
224
241
|
metadata: mockResponse.metadata,
|
|
225
242
|
data: testData, // Should match our original test data
|
|
226
243
|
key: sealed.key,
|
package/src/utils/connections.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
ComponentRequest,
|
|
3
|
+
RefreshSource,
|
|
4
|
+
TransactionOptions,
|
|
5
|
+
TransactionResponse,
|
|
6
|
+
UUID,
|
|
7
|
+
} from '../types';
|
|
2
8
|
import { seal, unseal } from './encryption';
|
|
3
9
|
|
|
4
10
|
export type TransactionType = 'withdraw' | 'deposit';
|
|
11
|
+
export type ConnectionStatus = 'active' | 'completed' | 'closed';
|
|
5
12
|
export interface ConnectionData<T extends ComponentRequest> {
|
|
6
13
|
tx: T;
|
|
7
14
|
authToken?: string;
|
|
8
15
|
txOptions?: TransactionOptions;
|
|
16
|
+
result?: TransactionResponse<T>;
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
export interface ConnectionMetadata {
|
|
@@ -16,11 +24,55 @@ export interface ConnectionMetadata {
|
|
|
16
24
|
export interface ConnectionResponse<T extends ComponentRequest> {
|
|
17
25
|
id: UUID;
|
|
18
26
|
version: number;
|
|
27
|
+
status: ConnectionStatus;
|
|
19
28
|
metadata: ConnectionMetadata;
|
|
20
29
|
data: ConnectionData<T>;
|
|
21
30
|
key: string;
|
|
22
31
|
}
|
|
23
32
|
|
|
33
|
+
export interface ConnectionResult<T extends ComponentRequest> {
|
|
34
|
+
id: UUID;
|
|
35
|
+
metadata: ConnectionMetadata;
|
|
36
|
+
status: ConnectionStatus;
|
|
37
|
+
tx: T;
|
|
38
|
+
result?: TransactionResponse<T>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function getRefreshResult<T extends ComponentRequest>(
|
|
42
|
+
refreshSource: RefreshSource,
|
|
43
|
+
): Promise<ConnectionResult<T>> {
|
|
44
|
+
const response = await fetch(refreshSource.url, {
|
|
45
|
+
method: 'GET',
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
throw new Error(`Failed to get connection: ${await response.text()}`);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const result = await response.json();
|
|
53
|
+
|
|
54
|
+
if (!result.sealed) {
|
|
55
|
+
throw new Error('No data found');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Get the latest sealed data
|
|
59
|
+
const latestSealed = result.sealed[result.sealed.length - 1];
|
|
60
|
+
|
|
61
|
+
// Decrypt the data
|
|
62
|
+
const data = await unseal<ConnectionData<T>>({
|
|
63
|
+
ciphertext: latestSealed,
|
|
64
|
+
key: refreshSource.key,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
id: result.id,
|
|
69
|
+
metadata: result.metadata,
|
|
70
|
+
status: result.status,
|
|
71
|
+
tx: data.tx,
|
|
72
|
+
result: data.result,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
24
76
|
/**
|
|
25
77
|
* Manages encrypted connections using Cloudflare Durable Objects
|
|
26
78
|
*/
|
|
@@ -68,6 +120,7 @@ export class ConnectionManager {
|
|
|
68
120
|
return {
|
|
69
121
|
id: result.id,
|
|
70
122
|
version: result.version,
|
|
123
|
+
status: result.status,
|
|
71
124
|
metadata: metadata,
|
|
72
125
|
data: data,
|
|
73
126
|
key: sealed.key,
|
|
@@ -85,14 +138,17 @@ export class ConnectionManager {
|
|
|
85
138
|
id: UUID,
|
|
86
139
|
data: ConnectionData<T>,
|
|
87
140
|
version: number,
|
|
141
|
+
status: ConnectionStatus,
|
|
142
|
+
key: string,
|
|
88
143
|
): Promise<ConnectionResponse<T>> {
|
|
89
144
|
// Encrypt the new data
|
|
90
|
-
const sealed = await seal(data);
|
|
145
|
+
const sealed = await seal(data, key);
|
|
91
146
|
|
|
92
147
|
// Prepare the request body
|
|
93
148
|
const body = {
|
|
94
149
|
sealed: sealed.ciphertext,
|
|
95
150
|
version,
|
|
151
|
+
status,
|
|
96
152
|
};
|
|
97
153
|
|
|
98
154
|
// Update the connection
|
|
@@ -114,6 +170,7 @@ export class ConnectionManager {
|
|
|
114
170
|
id: result.id,
|
|
115
171
|
metadata: result.metadata,
|
|
116
172
|
version: result.version,
|
|
173
|
+
status: result.status,
|
|
117
174
|
data: data,
|
|
118
175
|
key: sealed.key,
|
|
119
176
|
};
|
|
@@ -151,6 +208,7 @@ export class ConnectionManager {
|
|
|
151
208
|
|
|
152
209
|
return {
|
|
153
210
|
id: result.id,
|
|
211
|
+
status: result.status,
|
|
154
212
|
version: result.version,
|
|
155
213
|
metadata: result.metadata,
|
|
156
214
|
data,
|
package/src/utils/encryption.ts
CHANGED
|
@@ -14,13 +14,15 @@ export interface Sealed {
|
|
|
14
14
|
* @param data Data to encrypt
|
|
15
15
|
* @returns Promise resolving to a Sealed object containing ciphertext and key
|
|
16
16
|
*/
|
|
17
|
-
export async function seal<T>(data: T): Promise<Sealed> {
|
|
17
|
+
export async function seal<T>(data: T, existingKey?: string): Promise<Sealed> {
|
|
18
18
|
// Convert the object to a JSON string
|
|
19
19
|
const plaintext = JSON.stringify(data);
|
|
20
20
|
const encoder = new TextEncoder();
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
const rawKey =
|
|
22
|
+
// Restore or generate a random encryption key
|
|
23
|
+
const rawKey = existingKey
|
|
24
|
+
? base64ToUint8Array(existingKey)
|
|
25
|
+
: crypto.getRandomValues(new Uint8Array(32));
|
|
24
26
|
const key = await crypto.subtle.importKey(
|
|
25
27
|
'raw',
|
|
26
28
|
rawKey,
|