@notabene/javascript-sdk 2.8.0-next.4 → 2.8.0-next.6
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/README.md +30 -0
- package/dist/cjs/notabene.cjs +1 -1
- package/dist/cjs/notabene.d.ts +92 -8
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +92 -8
- package/dist/esm/notabene.js +282 -137
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +92 -8
- package/dist/notabene.js +282 -137
- package/docs/README.md +30 -0
- 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/README.md +5 -0
- package/docs/notabene/classes/ConnectionManager.md +165 -0
- 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 +41 -0
- package/docs/notabene/interfaces/ConnectionMetadata.md +37 -0
- package/docs/notabene/interfaces/ConnectionResponse.md +61 -0
- package/docs/notabene/interfaces/NotabeneConfig.md +5 -5
- package/docs/notabene/type-aliases/MessageCallback.md +1 -1
- package/docs/notabene/type-aliases/TransactionType.md +13 -0
- package/docs/types/README.md +1 -0
- 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 +16 -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 +9 -9
- 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 +3 -3
- package/docs/types/type-aliases/NationalIdentifierTypeFieldOptions.md +21 -0
- package/docs/types/type-aliases/NaturalPersonFieldName.md +1 -1
- package/docs/types/type-aliases/NaturalPersonFields.md +3 -3
- 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 +7 -0
- package/src/types.ts +35 -7
- package/src/utils/__tests__/connections.test.ts +284 -0
- package/src/utils/__tests__/encryption.test.ts +79 -0
- package/src/utils/connections.ts +174 -0
- package/src/utils/encryption.ts +111 -0
package/README.md
CHANGED
|
@@ -638,6 +638,36 @@ const options: TransactionOptions = {
|
|
|
638
638
|
};
|
|
639
639
|
```
|
|
640
640
|
|
|
641
|
+
### Configuring National Identifier Type
|
|
642
|
+
|
|
643
|
+
The National Identifier Type is a dropdown that allows the developer configure the types of national identifiers they are supporting.
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
const options: TransactionOptions = {
|
|
647
|
+
fields: {
|
|
648
|
+
naturalPerson: {
|
|
649
|
+
name: {optional: false},
|
|
650
|
+
nationalIdentification: {
|
|
651
|
+
optional: true, // allow optional national identification
|
|
652
|
+
nationalIdentifierType: {
|
|
653
|
+
values: ['ARNU', 'CCPT', 'RAID', 'DRLC', 'TXID', 'SOCS'], // default values
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
},
|
|
657
|
+
legalPerson: {
|
|
658
|
+
name: true,
|
|
659
|
+
lei: {optional: true},
|
|
660
|
+
nationalIdentification: {
|
|
661
|
+
optional: false, // require national identification
|
|
662
|
+
nationalIdentifierType: {
|
|
663
|
+
values: ['RAID', 'TXID', 'MISC'], // default values
|
|
664
|
+
},
|
|
665
|
+
},
|
|
666
|
+
},
|
|
667
|
+
},
|
|
668
|
+
};
|
|
669
|
+
```
|
|
670
|
+
|
|
641
671
|
### Configuring ownership proofs
|
|
642
672
|
|
|
643
673
|
By default components support message signing proofs.
|
package/dist/cjs/notabene.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var N=Object.defineProperty;var U=(t,e,n)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var a=(t,e,n)=>U(t,typeof e!="symbol"?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var p=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(p||{}),E=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(E||{}),f=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(f||{}),w=(t=>(t.ALLOWED="allowed",t.PENDING="pending",t))(w||{}),v=(t=>(t.ASSET="asset",t.DESTINATION="destination",t.COUNTERPARTY="counterparty",t.AGENT="agent",t))(v||{}),l=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t))(l||{}),g=(t=>(t.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",t.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",t.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",t.TOKEN_INVALID="TOKEN_INVALID",t))(g||{}),d=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(d||{}),y=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(y||{}),A=(t=>(t.SelfDeclaration="self-declaration",t.SIWE="siwe",t.SIWX="siwx",t.EIP191="eip-191",t.EIP712="eip-712",t.EIP1271="eip-1271",t.BIP137="bip-137",t.BIP322="bip-322",t.BIP137_XPUB="xpub",t.TIP191="tip-191",t.ED25519="ed25519",t.XRP_ED25519="xrp-ed25519",t.CIP8="cip-8",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t.Connect="connect",t))(A||{});class _{constructor(){a(this,"listeners",new Map);a(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(e){this.port=e,this.port.onmessage=this.handleMessage,this.port.start()}on(e,n){return this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(n),()=>this.off(e,n)}off(e,n){const r=this.listeners.get(e);r&&(r.delete(n),r.size===0&&this.listeners.delete(e))}handleMessage(e){const n=e.data;if(typeof n=="object"&&n!==null&&"type"in n){const r=n.type,i=this.listeners.get(r);i&&i.forEach(s=>s(n))}}send(e){this.port&&this.port.postMessage(e)}}class C{constructor(e,n,r){a(this,"_url");a(this,"_value");a(this,"_options");a(this,"_errors",[]);a(this,"iframe");a(this,"eventManager");a(this,"modal");this._url=e,this._value=n,this._options=r,this.eventManager=new _,this.on(l.INVALID,i=>{i.type===l.INVALID&&(this._errors=i.errors,this._value=i.value)}),this.on(l.RESIZE,i=>{i.type===l.RESIZE&&this.iframe&&(this.iframe.style.height=`${i.height}px`)})}get url(){return this._url}get value(){return this._value}get options(){return this._options}get errors(){return this._errors}open(){document.location.href=this.url}mount(e){const n=document.querySelector(e);if(!n)throw new Error(`parentID ${e} not found`);this.embed(n)}embed(e,n=!1){var r,i;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(n?"":"&embedded=true"),this.iframe.allow="web-share; clipboard-write; hid; bluetooth;",this.iframe.style.width="100%",this.iframe.style.height="0px",this.iframe.style.border="none",this.iframe.style.overflow="hidden",this.iframe.scrolling="no",e.appendChild(this.iframe),window.addEventListener("message",s=>{var o,c;s.source===((o=this.iframe)==null?void 0:o.contentWindow)&&((c=this.eventManager)==null||c.setPort(s.ports[0]))}),(i=(r=this.iframe)==null?void 0:r.contentWindow)==null||i.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(e){this.eventManager.send(e)}on(e,n){return this.eventManager.on(e,n)}off(e,n){this.eventManager.off(e,n)}update(e,n){this._value=e,n&&(this._options=n),this.send({type:d.UPDATE,value:e,options:this._options})}completion(){return new Promise((e,n)=>{let r,i,s;function o(){r&&r(),i&&i(),s&&s()}r=this.on(l.COMPLETE,c=>{e(c.response),o()}),i=this.on(l.CANCEL,()=>{n(new Error("User cancelled")),o()}),s=this.on("error",c=>{n(new Error(c.message)),o()})})}async openModal(){this.modal&&this.closeModal(),this.modal=document.createElement("dialog"),this.modal.style.border="none",this.modal.style.backgroundColor="white",this.modal.style.maxWidth="100vw",this.modal.style.maxHeight="100vh",this.modal.style.width="600px",this.modal.style.height="600px",document.body.appendChild(this.modal),this.embed(this.modal,!0);const e=this.on(l.CANCEL,()=>{this.closeModal()}),n=this.on(l.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{e(),n()})}closeModal(){var e;this.modal&&((e=this.modal)==null||e.close(),this.modal.remove(),this.modal=void 0)}async popup(){const e=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",i=>{var s;i.source===e&&(console.log("received message from popup",i.data),(s=this.eventManager)==null||s.setPort(i.ports[0]))});const n=this.on(l.CANCEL,()=>{e==null||e.close()}),r=this.on(l.COMPLETE,()=>{e==null||e.close()});return this.completion().finally(()=>{n(),r()})}}function S(t){return Object.entries(t).map(([e,n])=>{if(n==null)return;const r=encodeURIComponent(e),i=encodeURIComponent(typeof n=="object"?JSON.stringify(n):String(n));return`${r}=${i}`}).filter(e=>e!==void 0).join("&")}function O(t){const e=t.slice(1);return e?e.split("&").filter(Boolean).reduce((r,i)=>{const[s,o]=i.split("=");return s&&(r[decodeURIComponent(s)]=o?decodeURIComponent(o):""),r},{}):{}}async function u(t){const e=JSON.stringify(t),n=new TextEncoder,r=crypto.getRandomValues(new Uint8Array(32)),i=await crypto.subtle.importKey("raw",r,{name:"AES-GCM"},!1,["encrypt"]),s=crypto.getRandomValues(new Uint8Array(12)),o=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},i,n.encode(e));return{ciphertext:`${h(s)}-${h(o)}`,key:h(r)}}async function M({ciphertext:t,key:e}){const[n,r]=t.split("-"),i=new Uint8Array(atob(e).split("").map(L=>L.charCodeAt(0))),s=m(n),o=m(r),c=await crypto.subtle.importKey("raw",i,{name:"AES-GCM"},!1,["decrypt"]),b=new TextDecoder,I=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(s)},c,o);return JSON.parse(b.decode(I))}function h(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++)n+=String.fromCharCode(e[r]);return btoa(n)}function m(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}class R{constructor(e){a(this,"endpoint");this.endpoint=e}async create(e,n){const r=await u(e),i={metadata:n,sealed:r.ciphertext},s=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!s.ok)throw new Error(`Failed to create connection: ${await s.text()}`);const o=await s.json();return{id:o.id,version:o.version,metadata:n,data:e,key:r.key}}async update(e,n,r){const i=await u(n),s={sealed:i.ciphertext,version:r},o=await fetch(`${this.endpoint}/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new Error(`Failed to update connection: ${await o.text()}`);const c=await o.json();return{id:c.id,metadata:c.metadata,version:c.version,data:n,key:i.key}}async get(e,n){const r=await fetch(`${this.endpoint}/${e}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to get connection: ${await r.text()}`);const i=await r.json(),s=i.sealed[i.sealed.length-1],o=await M({ciphertext:s,key:n});return{id:i.id,version:i.version,metadata:i.metadata,data:o,key:n}}async close(e){const n=await fetch(`${this.endpoint}/${e}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to close connection: ${await n.text()}`)}}class D{constructor(e){a(this,"nodeUrl");a(this,"authToken");a(this,"uxUrl");a(this,"theme");a(this,"locale");this.uxUrl=e.uxUrl||"https://connect.notabene.id",this.nodeUrl=e.nodeUrl,this.authToken=e.authToken,this.theme=e.theme,this.locale=e.locale}componentUrl(e,n,r,i){const s=new URL(this.uxUrl);s.pathname=e;const o=S({authToken:this.authToken,value:n,configuration:r});return s.hash=o,this.nodeUrl&&s.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&s.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&s.searchParams.set("locale",this.locale),i&&(i.callback&&s.searchParams.set("callback_url",i.callback),i.redirectUri&&s.searchParams.set("redirect_uri",i.redirectUri)),s.toString()}createComponent(e,n,r,i){return new C(this.componentUrl(e,n,r,i),n,r)}createWithdrawalAssist(e,n,r){return this.createComponent("withdrawal-assist",e,n,r)}createConnectWallet(e,n,r){return this.createComponent("connect",e,n,r)}createDepositRequest(e,n,r){return this.createComponent("deposit-request",e,n,r)}createDepositAssist(e,n,r){return this.createComponent("deposit-assist",e,n,r)}}exports.AgentType=p;exports.CMType=l;exports.ConnectionManager=R;exports.EmbeddedComponent=C;exports.ErrorIdentifierCode=g;exports.HMType=d;exports.PersonType=E;exports.ProofStatus=y;exports.ProofTypes=A;exports.Status=f;exports.VASPSearchControl=w;exports.ValidationSections=v;exports.decodeFragmentToObject=O;exports.default=D;
|
package/dist/cjs/notabene.d.ts
CHANGED
|
@@ -290,6 +290,53 @@ export declare interface ComponentResponse {
|
|
|
290
290
|
errors: ValidationError[];
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
export declare interface ConnectionData<T extends ComponentRequest> {
|
|
294
|
+
tx: T;
|
|
295
|
+
authToken?: string;
|
|
296
|
+
txOptions?: TransactionOptions;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Manages encrypted connections using Cloudflare Durable Objects
|
|
301
|
+
*/
|
|
302
|
+
export declare class ConnectionManager {
|
|
303
|
+
private endpoint;
|
|
304
|
+
constructor(endpoint: string);
|
|
305
|
+
/**
|
|
306
|
+
* Creates a new encrypted connection
|
|
307
|
+
* @param data The component request data to encrypt and store
|
|
308
|
+
* @param participants Array of participant identifiers
|
|
309
|
+
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
310
|
+
*/
|
|
311
|
+
create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
|
|
312
|
+
/**
|
|
313
|
+
* Updates an existing connection with new encrypted data
|
|
314
|
+
* @param id Connection ID
|
|
315
|
+
* @param data New data to encrypt and store
|
|
316
|
+
* @param version Current version number
|
|
317
|
+
* @returns Promise resolving to updated connection details including new encryption key
|
|
318
|
+
*/
|
|
319
|
+
update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number): Promise<ConnectionResponse<T>>;
|
|
320
|
+
/**
|
|
321
|
+
* Retrieves and decrypts connection data
|
|
322
|
+
* @param id Connection ID
|
|
323
|
+
* @param key Encryption key from previous create/update operation
|
|
324
|
+
* @returns Promise resolving to connection details including decrypted data
|
|
325
|
+
*/
|
|
326
|
+
get<T extends ComponentRequest>(id: UUID, key: string): Promise<ConnectionResponse<T>>;
|
|
327
|
+
/**
|
|
328
|
+
* Closes a connection
|
|
329
|
+
* @param id Connection ID
|
|
330
|
+
*/
|
|
331
|
+
close(id: UUID): Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export declare interface ConnectionMetadata {
|
|
335
|
+
nodeUrl?: string;
|
|
336
|
+
participants: string[];
|
|
337
|
+
transactionType: TransactionType;
|
|
338
|
+
}
|
|
339
|
+
|
|
293
340
|
/**
|
|
294
341
|
* An object representing options for a Connection Request
|
|
295
342
|
* @public
|
|
@@ -304,6 +351,14 @@ export declare interface ConnectionRequest extends ComponentRequest {
|
|
|
304
351
|
asset: TransactionAsset;
|
|
305
352
|
}
|
|
306
353
|
|
|
354
|
+
export declare interface ConnectionResponse<T extends ComponentRequest> {
|
|
355
|
+
id: UUID;
|
|
356
|
+
version: number;
|
|
357
|
+
metadata: ConnectionMetadata;
|
|
358
|
+
data: ConnectionData<T>;
|
|
359
|
+
key: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
307
362
|
/**
|
|
308
363
|
* The counterparty of a transaction.
|
|
309
364
|
* @public
|
|
@@ -728,12 +783,21 @@ declare type LegalPerson_2 = {
|
|
|
728
783
|
export declare type LegalPersonFieldName = 'name' | 'lei' | 'website' | 'email' | 'phone' | 'geographicAddress' | 'nationalIdentification' | 'countryOfRegistration';
|
|
729
784
|
|
|
730
785
|
/**
|
|
731
|
-
* Field properties
|
|
786
|
+
* Field properties for legal person fields
|
|
732
787
|
* @public
|
|
733
788
|
*/
|
|
734
|
-
export declare type LegalPersonFields = {
|
|
735
|
-
|
|
736
|
-
|
|
789
|
+
export declare type LegalPersonFields = Partial<{
|
|
790
|
+
name: FieldOptions;
|
|
791
|
+
lei: FieldOptions;
|
|
792
|
+
website: FieldOptions;
|
|
793
|
+
email: FieldOptions;
|
|
794
|
+
phone: FieldOptions;
|
|
795
|
+
geographicAddress: FieldOptions;
|
|
796
|
+
nationalIdentification: FieldOptions & {
|
|
797
|
+
nationalIdentifierType: NationalIdentifierTypeFieldOptions;
|
|
798
|
+
};
|
|
799
|
+
countryOfRegistration: FieldOptions;
|
|
800
|
+
}>;
|
|
737
801
|
|
|
738
802
|
/**
|
|
739
803
|
* Legal Person Name
|
|
@@ -845,6 +909,14 @@ export declare type NationalIdentification = {
|
|
|
845
909
|
*/
|
|
846
910
|
declare type NationalIdentifierTypeCode = 'ARNU' | 'CCPT' | 'RAID' | 'DRLC' | 'FIIN' | 'TXID' | 'SOCS' | 'IDCD' | 'LEIX' | 'MISC';
|
|
847
911
|
|
|
912
|
+
/**
|
|
913
|
+
* Field properties for national identifier type selection
|
|
914
|
+
* @public
|
|
915
|
+
*/
|
|
916
|
+
declare type NationalIdentifierTypeFieldOptions = {
|
|
917
|
+
values?: NationalIdentifierTypeCode[];
|
|
918
|
+
};
|
|
919
|
+
|
|
848
920
|
/**
|
|
849
921
|
* Interface representing a natural person (individual) involved in a transaction
|
|
850
922
|
*
|
|
@@ -899,12 +971,22 @@ declare type NaturalPerson_2 = {
|
|
|
899
971
|
export declare type NaturalPersonFieldName = 'name' | 'website' | 'email' | 'phone' | 'geographicAddress' | 'nationalIdentification' | 'dateOfBirth' | 'placeOfBirth' | 'countryOfResidence';
|
|
900
972
|
|
|
901
973
|
/**
|
|
902
|
-
* Field properties
|
|
974
|
+
* Field properties for natural person fields
|
|
903
975
|
* @public
|
|
904
976
|
*/
|
|
905
|
-
export declare type NaturalPersonFields = {
|
|
906
|
-
|
|
907
|
-
|
|
977
|
+
export declare type NaturalPersonFields = Partial<{
|
|
978
|
+
name: FieldOptions;
|
|
979
|
+
website: FieldOptions;
|
|
980
|
+
email: FieldOptions;
|
|
981
|
+
phone: FieldOptions;
|
|
982
|
+
geographicAddress: FieldOptions;
|
|
983
|
+
nationalIdentification: FieldOptions & {
|
|
984
|
+
nationalIdentifierType: NationalIdentifierTypeFieldOptions;
|
|
985
|
+
};
|
|
986
|
+
dateOfBirth: FieldOptions;
|
|
987
|
+
placeOfBirth: FieldOptions;
|
|
988
|
+
countryOfResidence: FieldOptions;
|
|
989
|
+
}>;
|
|
908
990
|
|
|
909
991
|
/**
|
|
910
992
|
* Natural Person Name
|
|
@@ -1458,6 +1540,8 @@ export declare interface TransactionResponse<V> extends ComponentResponse {
|
|
|
1458
1540
|
txUpdate?: V1Transaction;
|
|
1459
1541
|
}
|
|
1460
1542
|
|
|
1543
|
+
export declare type TransactionType = 'withdraw' | 'deposit';
|
|
1544
|
+
|
|
1461
1545
|
/**
|
|
1462
1546
|
* Transfer Path
|
|
1463
1547
|
* Represents the path of intermediary VASPs in a transfer
|
package/dist/cjs/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.8.0-next.
|
|
13
|
+
"version": "2.8.0-next.6",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
package/dist/esm/notabene.d.ts
CHANGED
|
@@ -290,6 +290,53 @@ export declare interface ComponentResponse {
|
|
|
290
290
|
errors: ValidationError[];
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
export declare interface ConnectionData<T extends ComponentRequest> {
|
|
294
|
+
tx: T;
|
|
295
|
+
authToken?: string;
|
|
296
|
+
txOptions?: TransactionOptions;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Manages encrypted connections using Cloudflare Durable Objects
|
|
301
|
+
*/
|
|
302
|
+
export declare class ConnectionManager {
|
|
303
|
+
private endpoint;
|
|
304
|
+
constructor(endpoint: string);
|
|
305
|
+
/**
|
|
306
|
+
* Creates a new encrypted connection
|
|
307
|
+
* @param data The component request data to encrypt and store
|
|
308
|
+
* @param participants Array of participant identifiers
|
|
309
|
+
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
310
|
+
*/
|
|
311
|
+
create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
|
|
312
|
+
/**
|
|
313
|
+
* Updates an existing connection with new encrypted data
|
|
314
|
+
* @param id Connection ID
|
|
315
|
+
* @param data New data to encrypt and store
|
|
316
|
+
* @param version Current version number
|
|
317
|
+
* @returns Promise resolving to updated connection details including new encryption key
|
|
318
|
+
*/
|
|
319
|
+
update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number): Promise<ConnectionResponse<T>>;
|
|
320
|
+
/**
|
|
321
|
+
* Retrieves and decrypts connection data
|
|
322
|
+
* @param id Connection ID
|
|
323
|
+
* @param key Encryption key from previous create/update operation
|
|
324
|
+
* @returns Promise resolving to connection details including decrypted data
|
|
325
|
+
*/
|
|
326
|
+
get<T extends ComponentRequest>(id: UUID, key: string): Promise<ConnectionResponse<T>>;
|
|
327
|
+
/**
|
|
328
|
+
* Closes a connection
|
|
329
|
+
* @param id Connection ID
|
|
330
|
+
*/
|
|
331
|
+
close(id: UUID): Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export declare interface ConnectionMetadata {
|
|
335
|
+
nodeUrl?: string;
|
|
336
|
+
participants: string[];
|
|
337
|
+
transactionType: TransactionType;
|
|
338
|
+
}
|
|
339
|
+
|
|
293
340
|
/**
|
|
294
341
|
* An object representing options for a Connection Request
|
|
295
342
|
* @public
|
|
@@ -304,6 +351,14 @@ export declare interface ConnectionRequest extends ComponentRequest {
|
|
|
304
351
|
asset: TransactionAsset;
|
|
305
352
|
}
|
|
306
353
|
|
|
354
|
+
export declare interface ConnectionResponse<T extends ComponentRequest> {
|
|
355
|
+
id: UUID;
|
|
356
|
+
version: number;
|
|
357
|
+
metadata: ConnectionMetadata;
|
|
358
|
+
data: ConnectionData<T>;
|
|
359
|
+
key: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
307
362
|
/**
|
|
308
363
|
* The counterparty of a transaction.
|
|
309
364
|
* @public
|
|
@@ -728,12 +783,21 @@ declare type LegalPerson_2 = {
|
|
|
728
783
|
export declare type LegalPersonFieldName = 'name' | 'lei' | 'website' | 'email' | 'phone' | 'geographicAddress' | 'nationalIdentification' | 'countryOfRegistration';
|
|
729
784
|
|
|
730
785
|
/**
|
|
731
|
-
* Field properties
|
|
786
|
+
* Field properties for legal person fields
|
|
732
787
|
* @public
|
|
733
788
|
*/
|
|
734
|
-
export declare type LegalPersonFields = {
|
|
735
|
-
|
|
736
|
-
|
|
789
|
+
export declare type LegalPersonFields = Partial<{
|
|
790
|
+
name: FieldOptions;
|
|
791
|
+
lei: FieldOptions;
|
|
792
|
+
website: FieldOptions;
|
|
793
|
+
email: FieldOptions;
|
|
794
|
+
phone: FieldOptions;
|
|
795
|
+
geographicAddress: FieldOptions;
|
|
796
|
+
nationalIdentification: FieldOptions & {
|
|
797
|
+
nationalIdentifierType: NationalIdentifierTypeFieldOptions;
|
|
798
|
+
};
|
|
799
|
+
countryOfRegistration: FieldOptions;
|
|
800
|
+
}>;
|
|
737
801
|
|
|
738
802
|
/**
|
|
739
803
|
* Legal Person Name
|
|
@@ -845,6 +909,14 @@ export declare type NationalIdentification = {
|
|
|
845
909
|
*/
|
|
846
910
|
declare type NationalIdentifierTypeCode = 'ARNU' | 'CCPT' | 'RAID' | 'DRLC' | 'FIIN' | 'TXID' | 'SOCS' | 'IDCD' | 'LEIX' | 'MISC';
|
|
847
911
|
|
|
912
|
+
/**
|
|
913
|
+
* Field properties for national identifier type selection
|
|
914
|
+
* @public
|
|
915
|
+
*/
|
|
916
|
+
declare type NationalIdentifierTypeFieldOptions = {
|
|
917
|
+
values?: NationalIdentifierTypeCode[];
|
|
918
|
+
};
|
|
919
|
+
|
|
848
920
|
/**
|
|
849
921
|
* Interface representing a natural person (individual) involved in a transaction
|
|
850
922
|
*
|
|
@@ -899,12 +971,22 @@ declare type NaturalPerson_2 = {
|
|
|
899
971
|
export declare type NaturalPersonFieldName = 'name' | 'website' | 'email' | 'phone' | 'geographicAddress' | 'nationalIdentification' | 'dateOfBirth' | 'placeOfBirth' | 'countryOfResidence';
|
|
900
972
|
|
|
901
973
|
/**
|
|
902
|
-
* Field properties
|
|
974
|
+
* Field properties for natural person fields
|
|
903
975
|
* @public
|
|
904
976
|
*/
|
|
905
|
-
export declare type NaturalPersonFields = {
|
|
906
|
-
|
|
907
|
-
|
|
977
|
+
export declare type NaturalPersonFields = Partial<{
|
|
978
|
+
name: FieldOptions;
|
|
979
|
+
website: FieldOptions;
|
|
980
|
+
email: FieldOptions;
|
|
981
|
+
phone: FieldOptions;
|
|
982
|
+
geographicAddress: FieldOptions;
|
|
983
|
+
nationalIdentification: FieldOptions & {
|
|
984
|
+
nationalIdentifierType: NationalIdentifierTypeFieldOptions;
|
|
985
|
+
};
|
|
986
|
+
dateOfBirth: FieldOptions;
|
|
987
|
+
placeOfBirth: FieldOptions;
|
|
988
|
+
countryOfResidence: FieldOptions;
|
|
989
|
+
}>;
|
|
908
990
|
|
|
909
991
|
/**
|
|
910
992
|
* Natural Person Name
|
|
@@ -1458,6 +1540,8 @@ export declare interface TransactionResponse<V> extends ComponentResponse {
|
|
|
1458
1540
|
txUpdate?: V1Transaction;
|
|
1459
1541
|
}
|
|
1460
1542
|
|
|
1543
|
+
export declare type TransactionType = 'withdraw' | 'deposit';
|
|
1544
|
+
|
|
1461
1545
|
/**
|
|
1462
1546
|
* Transfer Path
|
|
1463
1547
|
* Represents the path of intermediary VASPs in a transfer
|