@notabene/javascript-sdk 2.14.0-next.4 → 2.14.1-next.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/dist/cjs/notabene.cjs +1 -1
- package/dist/cjs/notabene.d.ts +73 -51
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +73 -51
- package/dist/esm/notabene.js +363 -335
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +73 -51
- package/dist/notabene.js +363 -335
- package/package.json +1 -1
- package/src/responseTransformer/__tests__/transformer.test.ts +597 -0
- package/src/responseTransformer/mappers.ts +80 -26
- package/src/responseTransformer/transformer.ts +121 -73
- package/src/responseTransformer/types.ts +11 -1
- package/src/responseTransformer/utils.ts +13 -0
- package/src/types.ts +0 -3
package/dist/cjs/notabene.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var W=Object.defineProperty;var k=(e,t,n)=>t in e?W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var c=(e,t,n)=>k(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var N=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(N||{}),m=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(m||{}),w=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(w||{}),C=(e=>(e.ALLOWED="allowed",e.PENDING="pending",e))(C||{}),L=(e=>(e.SMS="sms",e.EMAIL="email",e))(L||{}),P=(e=>(e.PENDING="pending",e.APPROVED="approved",e.FAILED="failed",e.EXPIRED="expired",e.MAX_ATTEMPTS_REACHED="max_attempts_reached",e.UNREACHABLE="unreachable",e))(P||{}),R=(e=>(e.COINBASE="coinbase",e))(R||{}),S=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(S||{}),l=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e.WARNING="warning",e.INFO="info",e))(l||{}),v=(e=>(e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",e.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",e.TOKEN_INVALID="TOKEN_INVALID",e))(v||{}),T=(e=>(e.WALLET_ADDRESS_NOT_CONNECTED="WALLET_ADDRESS_NOT_CONNECTED",e.WALLET_LOCKED="WALLET_LOCKED",e.WALLET_UNREACHABLE="WALLET_UNREACHABLE",e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE="JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE",e.IDV_UNAVAILABLE="IDV_UNAVAILABLE",e))(T||{}),b=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(b||{}),_=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(_||{}),O=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.SOL_SIWX="sol-siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP322="bip-322",e.BIP137_XPUB="xpub",e.TIP191="tip-191",e.ED25519="ed25519",e.XRP_ED25519="xrp-ed25519",e.XLM_ED25519="xlm-ed25519",e.CIP8="cip-8",e.COSMOS="cosmos-ecdsa",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e.CONCORDIUM="concordium",e))(O||{});class j{constructor(){c(this,"listeners",new Map);c(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(t){this.port=t,this.port.onmessage=this.handleMessage,this.port.start()}on(t,n){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n),()=>this.off(t,n)}off(t,n){const r=this.listeners.get(t);r&&(r.delete(n),r.size===0&&this.listeners.delete(t))}handleMessage(t){const n=t.data;if(typeof n=="object"&&n!==null&&"type"in n){const r=n.type,o=this.listeners.get(r);o&&o.forEach(i=>i(n))}}send(t){this.port&&this.port.postMessage(t)}}class D{constructor(t,n,r){c(this,"_url");c(this,"_value");c(this,"_options");c(this,"_errors",[]);c(this,"iframe");c(this,"eventManager");c(this,"modal");this._url=t,this._value=n,this._options=r,this.eventManager=new j,this.on(l.INVALID,o=>{o.type===l.INVALID&&(this._errors=o.errors,this._value=o.value)}),this.on(l.RESIZE,o=>{o.type===l.RESIZE&&this.iframe&&(this.iframe.style.height=`${o.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(t){const n=document.querySelector(t);if(!n)throw new Error(`parentID ${t} not found`);this.embed(n)}embed(t,n=!1){var r,o;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",t.appendChild(this.iframe),window.addEventListener("message",i=>{var s,a;i.source===((s=this.iframe)==null?void 0:s.contentWindow)&&((a=this.eventManager)==null||a.setPort(i.ports[0]))}),(o=(r=this.iframe)==null?void 0:r.contentWindow)==null||o.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(t){this.eventManager.send(t)}on(t,n){return this.eventManager.on(t,n)}off(t,n){this.eventManager.off(t,n)}update(t,n){this._value=t,n&&(this._options=n),this.send({type:b.UPDATE,value:t,options:this._options})}completion(){return new Promise((t,n)=>{let r,o,i;function s(){r&&r(),o&&o(),i&&i()}r=this.on(l.COMPLETE,a=>{t(a.response),s()}),o=this.on(l.CANCEL,()=>{n(new Error("User cancelled")),s()}),i=this.on("error",a=>{n(new Error(a.message)),s()})})}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 t=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(()=>{t(),n()})}closeModal(){var t;this.modal&&((t=this.modal)==null||t.close(),this.modal.remove(),this.modal=void 0)}async popup(){const t=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",o=>{var i;o.source===t&&(console.log("received message from popup",o.data),(i=this.eventManager)==null||i.setPort(o.ports[0]))});const n=this.on(l.CANCEL,()=>{t==null||t.close()}),r=this.on(l.COMPLETE,()=>{t==null||t.close()});return this.completion().finally(()=>{n(),r()})}}function F(e){return Object.entries(e).map(([t,n])=>{if(n==null)return;const r=encodeURIComponent(t),o=encodeURIComponent(typeof n=="object"?JSON.stringify(n):String(n));return`${r}=${o}`}).filter(t=>t!==void 0).join("&")}function J(e){const t=e.slice(1);return t?t.split("&").filter(Boolean).reduce((r,o)=>{const[i,s]=o.split("=");return i&&(r[decodeURIComponent(i)]=s?decodeURIComponent(s):""),r},{}):{}}new TextEncoder;const E=new TextDecoder;function q(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function G(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:E.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=E.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return q(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class U extends Error{constructor(n,r){var o;super(n,r);c(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(o=Error.captureStackTrace)==null||o.call(Error,this,this.constructor)}}c(U,"code","ERR_JOSE_GENERIC");class u extends U{constructor(){super(...arguments);c(this,"code","ERR_JWT_INVALID")}}c(u,"code","ERR_JWT_INVALID");function $(e){return typeof e=="object"&&e!==null}const H=e=>{if(!$(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function K(e){if(typeof e!="string")throw new u("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:n}=e.split(".");if(n===5)throw new u("Only JWTs using Compact JWS serialization can be decoded");if(n!==3)throw new u("Invalid JWT");if(!t)throw new u("JWTs must contain a payload");let r;try{r=G(t)}catch{throw new u("Failed to base64url decode the payload")}let o;try{o=JSON.parse(E.decode(r))}catch{throw new u("Failed to parse the decoded payload as JSON")}if(!H(o))throw new u("Invalid JWT Claims Set");return o}function p(e,t){if(t!=null&&t.email)return`did:email:${t.email}`;if(t!=null&&t.name)return`did:name:${encodeURIComponent(t.name.replace(/\s+/g,"-"))}`;throw new Error(`Unable to generate ${e} ID: missing required ${e} information`)}function X(e){const{nameIdentifier:t,...n}=e;return{...n,nameIdentifier:t==null?void 0:t.map(({nameIdentifierType:r,...o})=>({...o,naturalPersonNameIdentifierType:r}))}}function z(e,t){return{naturalPerson:e.naturalPerson?{...e.naturalPerson,name:X(e.naturalPerson.name)}:void 0,legalPerson:e.legalPerson,accountNumber:[t]}}const A=[{addressType:"GEOG",addressLine:["1234 Main Street"],townName:"Unknown",country:"US"}];function Y(e){const t=e.trim();if(!t)return{primaryIdentifier:"",secondaryIdentifier:""};const n=t.split(/\s+/),r=n[n.length-1],o=n.slice(0,-1),i=o.length>0?o.join(" "):r;return{primaryIdentifier:r,secondaryIdentifier:i}}function Q(e,t,n=["1234567890"]){const r=t==null?void 0:t.map(o=>{const i={...o};return i.naturalPerson&&(i.naturalPerson={...i.naturalPerson,geographicAddress:A}),i.legalPerson&&(i.legalPerson={...i.legalPerson,geographicAddress:A}),i});return e==="originator"?{originatorPersons:r,accountNumber:n}:{beneficiaryPersons:r,accountNumber:n}}function Z(e,t="John Doe"){const{primaryIdentifier:n,secondaryIdentifier:r}=Y(t),o={naturalPerson:{name:[{nameIdentifier:[{primaryIdentifier:n,...r?{secondaryIdentifier:r}:{},nameIdentifierType:"LEGL"}]}],geographicAddress:A}};return e==="originator"?{originatorPersons:[o],accountNumber:["1234567890"]}:{beneficiaryPersons:[o],accountNumber:["1234567890"]}}const ee=e=>({...e,name:e.name?[e.name]:void 0}),te=e=>({...e,naturalPerson:e.naturalPerson?ee(e.naturalPerson):void 0}),ne=({beneficiary:e,originator:t},n,r,o,i)=>{var s;{const a=e&&{...e,...o&&{accountNumber:[o]},beneficiaryPersons:(s=e.beneficiaryPersons)==null?void 0:s.map(te)};if(r&&(a!=null&&a.beneficiaryPersons)){const d=Q("originator",a==null?void 0:a.beneficiaryPersons);return{beneficiary:{accountNumber:d.accountNumber,beneficiaryPersons:d.originatorPersons},originator:d}}return{beneficiary:a,originator:Z("originator",n)}}};function re(e,t,n){var i,s;const{beneficiary:r,originator:o}=ne(n,(i=e.customer)==null?void 0:i.name,t.originatorEqualsBeneficiary,e.destination);return{transactionAsset:t.transactionAsset,transactionAmount:t.transactionAmount,beneficiaryDid:(s=e.counterparty)==null?void 0:s.did,originatorVASPdid:t.originatorVASPdid,...t.beneficiaryVASPdid&&!t.beneficiaryProof?{beneficiaryVASPdid:t.beneficiaryVASPdid}:{},transactionBlockchainInfo:{...(o==null?void 0:o.accountNumber)&&{origin:o.accountNumber[0]},...e.destination&&{destination:e.destination}},...t.beneficiaryProof&&{beneficiaryProof:t.beneficiaryProof},...r&&{beneficiary:r},...o&&{originator:o},...t.originatorEqualsBeneficiary&&{originatorEqualsBeneficiary:t.originatorEqualsBeneficiary}}}function x(e,t,n={}){var a,d;const r=(n==null?void 0:n.originatorId)||p("originator",e.customer),o=(n==null?void 0:n.beneficiaryId)||p("beneficiary",e.counterparty),i=(n==null?void 0:n.referenceId)||Math.random().toString(36).substring(2,15),s=[];return t.originatorVASPdid&&s.push({"@id":t.originatorVASPdid,for:r,role:"VASP"}),t.beneficiaryVASPdid&&s.push({"@id":t.beneficiaryVASPdid,for:o,role:"VASP"}),e.destination&&((a=e==null?void 0:e.account)!=null&&a.did)&&s.push({"@id":e.account.did,for:t.beneficiaryVASPdid||o,role:"SettlementAddress"}),{originator:{"@id":r},beneficiary:{"@id":o},asset:e.asset,amount:((d=e.amountDecimal)==null?void 0:d.toString())||t.transactionAmount,agents:s,ref:i}}function M(e,t,n={}){var i,s,a;const r=n.beneficiaryId||p("beneficiary",e.counterparty),o=((i=e.counterparty)==null?void 0:i.type)===m.SELF&&n.originator?n.originator.originatorPerson:((a=(s=t.beneficiary)==null?void 0:s.beneficiaryPersons)==null?void 0:a.map(d=>z(d,r)))||[];return{ivms101:{originator:n.originator,beneficiary:{beneficiaryPerson:o}}}}function y(e,t,n){var o;const r={...e};if(!r.originatorId)try{const i=K(t);i!=null&&i.sub&&(r.originatorId=i.sub)}catch{}return r.beneficiaryId||(((o=n.counterparty)==null?void 0:o.type)===m.SELF?r.beneficiaryId=r.originatorId:n.destination&&(r.beneficiaryId=`did:key:${n.destination}`)),r}function oe(e){var s;if(!e.txCreate||!e.ivms101)throw new Error("Invalid response: missing required txCreate or ivms101 data");const{value:t,ivms101:n,proof:r,txCreate:o}=e,i={destination:(t==null?void 0:t.destination)||"",counterparty:(t==null?void 0:t.counterparty)||{},agent:t==null?void 0:t.agent,account:t==null?void 0:t.account,proof:r,asset:(t==null?void 0:t.asset)||(typeof o.transactionAsset=="string"?o.transactionAsset:(s=o.transactionAsset)==null?void 0:s.caip19)||"",amountDecimal:(t==null?void 0:t.amountDecimal)||(o.transactionAmount?parseFloat(o.transactionAmount):0),customer:t==null?void 0:t.customer};return re(i,o,n)}function ie(e,t,n={}){if(!e.txCreate||!e.ivms101)throw new Error("Invalid response: missing required txCreate or ivms101 data");const{value:r,txCreate:o,ivms101:i,proof:s}=e,a=y(n,t,r);return{createTx:x(r,o,a),ivms101:M(r,i,a),...s&&{confirmRelationship:{proof:s}}}}function se(e,t,n={}){if(!e.txCreate||!e.ivms101)throw new Error("Invalid response: missing required txCreate or ivms101 data");const{value:r,txCreate:o}=e,i=y(n,t,r);return x(r,o,i)}function ae(e,t,n={}){if(!e.ivms101)throw new Error("Invalid response: missing required ivms101 data");const{value:r,ivms101:o}=e,i=y(n,t,r);return M(r,o,i)}async function I(e,t){const n=JSON.stringify(e),r=new TextEncoder,o=t?g(t):crypto.getRandomValues(new Uint8Array(32)),i=await crypto.subtle.importKey("raw",o,{name:"AES-GCM"},!1,["encrypt"]),s=crypto.getRandomValues(new Uint8Array(12)),a=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},i,r.encode(n));return{ciphertext:`${f(s)}-${f(a)}`,key:f(o)}}async function V({ciphertext:e,key:t}){const[n,r]=e.split("-"),o=new Uint8Array(atob(t).split("").map(B=>B.charCodeAt(0))),i=g(n),s=g(r),a=await crypto.subtle.importKey("raw",o,{name:"AES-GCM"},!1,["decrypt"]),d=new TextDecoder,h=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(i)},a,s);return JSON.parse(d.decode(h))}function f(e){const t=new Uint8Array(e);let n="";for(let r=0;r<t.length;r++)n+=String.fromCharCode(t[r]);return btoa(n)}function g(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}async function ce(e){const t=await fetch(e.url,{method:"GET"});if(!t.ok)throw new Error(`Failed to get connection: ${await t.text()}`);const n=await t.json();if(!n.id||!n.metadata||!n.status||!n.sealed)throw new Error("Data missing from server response");const r={id:n.id,metadata:n.metadata,status:n.status};if(n.status==="closed")return r;const o=n.sealed[n.sealed.length-1],i=await V({ciphertext:o,key:e.key});return n.status==="completed"?{...r,result:i.result}:{...r,tx:i.tx}}class de{constructor(t){c(this,"endpoint");this.endpoint=t}async create(t,n){const r=await I(t),o={metadata:n,sealed:r.ciphertext},i=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create connection: ${await i.text()}`);const s=await i.json();return{id:s.id,version:s.version,status:s.status,metadata:n,data:t,key:r.key}}async update(t,n,r,o,i){const s=await I(n,i),a={sealed:s.ciphertext,version:r,status:o},d=await fetch(`${this.endpoint}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!d.ok)throw new Error(`Failed to update connection: ${await d.text()}`);const h=await d.json();return{id:h.id,metadata:h.metadata,version:h.version,status:h.status,data:n,key:s.key}}async get(t,n){const r=await fetch(`${this.endpoint}/${t}`,{method:"GET"});if(!r.ok)throw new Error(`Failed to get connection: ${await r.text()}`);const o=await r.json(),i=o.sealed[o.sealed.length-1],s=await V({ciphertext:i,key:n});return{id:o.id,status:o.status,version:o.version,metadata:o.metadata,data:s,key:n}}async close(t){const n=await fetch(`${this.endpoint}/${t}`,{method:"DELETE"});if(!n.ok)throw new Error(`Failed to close connection: ${await n.text()}`)}}class le{constructor(t){c(this,"nodeUrl");c(this,"authToken");c(this,"uxUrl");c(this,"theme");c(this,"locale");this.uxUrl=t.uxUrl||"https://connect.notabene.id",this.nodeUrl=t.nodeUrl,this.authToken=t.authToken,this.theme=t.theme,this.locale=t.locale}componentUrl(t,n,r,o){const i=new URL(this.uxUrl);i.pathname=t;const s=F({authToken:this.authToken,value:n,configuration:r});return i.hash=s,this.nodeUrl&&i.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&i.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&i.searchParams.set("locale",this.locale),o&&(o.callback&&i.searchParams.set("callback_url",o.callback),o.redirectUri&&i.searchParams.set("redirect_uri",o.redirectUri)),i.toString()}createComponent(t,n,r,o){return new D(this.componentUrl(t,n,r,o),n,r)}createWithdrawalAssist(t,n,r){return this.createComponent("withdrawal-assist",t,n,r)}createConnectWallet(t,n,r){return this.createComponent("connect",t,n,r)}createDepositRequest(t,n,r){return this.createComponent("deposit-request",t,n,r)}createDepositAssist(t,n,r){return this.createComponent("deposit-assist",t,n,r)}}exports.AgentType=N;exports.CMType=l;exports.CodeVerificationStatus=P;exports.ConnectionManager=de;exports.EmbeddedComponent=D;exports.ErrorIdentifierCode=v;exports.HMType=b;exports.IdentityVerificationMethod=L;exports.OAuthProvider=R;exports.PersonType=m;exports.ProofStatus=_;exports.ProofTypes=O;exports.Status=w;exports.VASPSearchControl=C;exports.ValidationSections=S;exports.WarningIdentifierCode=T;exports.componentResponseToIVMS101=ae;exports.componentResponseToTxCreateRequest=se;exports.componentResponseToTxRequests=ie;exports.componentResponseToV1TxCreateRequest=oe;exports.decodeFragmentToObject=J;exports.default=le;exports.getRefreshResult=ce;
|
|
1
|
+
"use strict";var q=Object.defineProperty;var G=(e,t,r)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var c=(e,t,r)=>G(e,typeof t!="symbol"?t+"":t,r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var C=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(C||{}),E=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(E||{}),T=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(T||{}),v=(e=>(e.ALLOWED="allowed",e.PENDING="pending",e))(v||{}),O=(e=>(e.SMS="sms",e.EMAIL="email",e))(O||{}),_=(e=>(e.PENDING="pending",e.APPROVED="approved",e.FAILED="failed",e.EXPIRED="expired",e.MAX_ATTEMPTS_REACHED="max_attempts_reached",e.UNREACHABLE="unreachable",e))(_||{}),D=(e=>(e.COINBASE="coinbase",e))(D||{}),U=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(U||{}),u=(e=>(e.COMPLETE="complete",e.RESIZE="resize",e.RESULT="result",e.READY="ready",e.INVALID="invalid",e.ERROR="error",e.CANCEL="cancel",e.WARNING="warning",e.INFO="info",e))(u||{}),x=(e=>(e.SERVICE_UNAVAILABLE="SERVICE_UNAVAILABLE",e.WALLET_CONNECTION_FAILED="WALLET_CONNECTION_FAILED",e.WALLET_NOT_SUPPORTED="WALLET_NOT_SUPPORTED",e.TOKEN_INVALID="TOKEN_INVALID",e))(x||{}),M=(e=>(e.WALLET_ADDRESS_NOT_CONNECTED="WALLET_ADDRESS_NOT_CONNECTED",e.WALLET_LOCKED="WALLET_LOCKED",e.WALLET_UNREACHABLE="WALLET_UNREACHABLE",e.JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE="JURISDICTIONAL_REQUIREMENTS_UNAVAILABLE",e.IDV_UNAVAILABLE="IDV_UNAVAILABLE",e))(M||{}),P=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(P||{}),V=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(V||{}),W=(e=>(e.SelfDeclaration="self-declaration",e.SIWE="siwe",e.SIWX="siwx",e.SOL_SIWX="sol-siwx",e.EIP191="eip-191",e.EIP712="eip-712",e.EIP1271="eip-1271",e.BIP137="bip-137",e.BIP322="bip-322",e.TIP191="tip-191",e.ED25519="ed25519",e.XRP_ED25519="xrp-ed25519",e.XLM_ED25519="xlm-ed25519",e.CIP8="cip-8",e.COSMOS="cosmos-ecdsa",e.MicroTransfer="microtransfer",e.Screenshot="screenshot",e.Connect="connect",e.CONCORDIUM="concordium",e))(W||{});class H{constructor(){c(this,"listeners",new Map);c(this,"port");this.handleMessage=this.handleMessage.bind(this)}setPort(t){this.port=t,this.port.onmessage=this.handleMessage,this.port.start()}on(t,r){return this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(r),()=>this.off(t,r)}off(t,r){const n=this.listeners.get(t);n&&(n.delete(r),n.size===0&&this.listeners.delete(t))}handleMessage(t){const r=t.data;if(typeof r=="object"&&r!==null&&"type"in r){const n=r.type,o=this.listeners.get(n);o&&o.forEach(i=>i(r))}}send(t){this.port&&this.port.postMessage(t)}}class k{constructor(t,r,n){c(this,"_url");c(this,"_value");c(this,"_options");c(this,"_errors",[]);c(this,"iframe");c(this,"eventManager");c(this,"modal");this._url=t,this._value=r,this._options=n,this.eventManager=new H,this.on(u.INVALID,o=>{o.type===u.INVALID&&(this._errors=o.errors,this._value=o.value)}),this.on(u.RESIZE,o=>{o.type===u.RESIZE&&this.iframe&&(this.iframe.style.height=`${o.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(t){const r=document.querySelector(t);if(!r)throw new Error(`parentID ${t} not found`);this.embed(r)}embed(t,r=!1){var n,o;this.removeEmbed(),this.iframe=document.createElement("iframe"),this.iframe.src=this.url+(r?"":"&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",t.appendChild(this.iframe),window.addEventListener("message",i=>{var s,a;i.source===((s=this.iframe)==null?void 0:s.contentWindow)&&((a=this.eventManager)==null||a.setPort(i.ports[0]))}),(o=(n=this.iframe)==null?void 0:n.contentWindow)==null||o.focus()}removeEmbed(){this.iframe&&this.iframe.remove()}send(t){this.eventManager.send(t)}on(t,r){return this.eventManager.on(t,r)}off(t,r){this.eventManager.off(t,r)}update(t,r){this._value=t,r&&(this._options=r),this.send({type:P.UPDATE,value:t,options:this._options})}completion(){return new Promise((t,r)=>{let n,o,i;function s(){n&&n(),o&&o(),i&&i()}n=this.on(u.COMPLETE,a=>{t(a.response),s()}),o=this.on(u.CANCEL,()=>{r(new Error("User cancelled")),s()}),i=this.on("error",a=>{r(new Error(a.message)),s()})})}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 t=this.on(u.CANCEL,()=>{this.closeModal()}),r=this.on(u.COMPLETE,()=>{this.closeModal()});return this.modal.showModal(),this.modal.addEventListener("click",()=>{this.closeModal()}),this.completion().finally(()=>{t(),r()})}closeModal(){var t;this.modal&&((t=this.modal)==null||t.close(),this.modal.remove(),this.modal=void 0)}async popup(){const t=window.open(this.url,"_blank","popup=true,width=600,height=600");window.addEventListener("message",o=>{var i;o.source===t&&(console.log("received message from popup",o.data),(i=this.eventManager)==null||i.setPort(o.ports[0]))});const r=this.on(u.CANCEL,()=>{t==null||t.close()}),n=this.on(u.COMPLETE,()=>{t==null||t.close()});return this.completion().finally(()=>{r(),n()})}}function K(e){return Object.entries(e).map(([t,r])=>{if(r==null)return;const n=encodeURIComponent(t),o=encodeURIComponent(typeof r=="object"?JSON.stringify(r):String(r));return`${n}=${o}`}).filter(t=>t!==void 0).join("&")}function X(e){const t=e.slice(1);return t?t.split("&").filter(Boolean).reduce((n,o)=>{const[i,s]=o.split("=");return i&&(n[decodeURIComponent(i)]=s?decodeURIComponent(s):""),n},{}):{}}new TextEncoder;const b=new TextDecoder;function z(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Y(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:b.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=b.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return z(t)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}class B extends Error{constructor(r,n){var o;super(r,n);c(this,"code","ERR_JOSE_GENERIC");this.name=this.constructor.name,(o=Error.captureStackTrace)==null||o.call(Error,this,this.constructor)}}c(B,"code","ERR_JOSE_GENERIC");class h extends B{constructor(){super(...arguments);c(this,"code","ERR_JWT_INVALID")}}c(h,"code","ERR_JWT_INVALID");function Q(e){return typeof e=="object"&&e!==null}const Z=e=>{if(!Q(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t};function ee(e){if(typeof e!="string")throw new h("JWTs must use Compact JWS serialization, JWT must be a string");const{1:t,length:r}=e.split(".");if(r===5)throw new h("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new h("Invalid JWT");if(!t)throw new h("JWTs must contain a payload");let n;try{n=Y(t)}catch{throw new h("Failed to base64url decode the payload")}let o;try{o=JSON.parse(b.decode(n))}catch{throw new h("Failed to parse the decoded payload as JSON")}if(!Z(o))throw new h("Invalid JWT Claims Set");return o}function N(e){return"source"in e&&e.source!==void 0}function p(e){return!N(e)}function g(e,t){if(t!=null&&t.email)return`did:email:${t.email}`;if(t!=null&&t.name)return`did:name:${encodeURIComponent(t.name.replace(/\s+/g,"-"))}`;throw new Error(`Unable to generate ${e} ID: missing required ${e} information`)}function te(e){const{nameIdentifier:t,...r}=e;return{...r,nameIdentifier:t==null?void 0:t.map(({nameIdentifierType:n,...o})=>({...o,naturalPersonNameIdentifierType:n}))}}function S(e,t){return{naturalPerson:e.naturalPerson?{...e.naturalPerson,name:te(e.naturalPerson.name)}:void 0,legalPerson:e.legalPerson,accountNumber:[t]}}const I=[{addressType:"GEOG",addressLine:["1234 Main Street"],townName:"Unknown",country:"US"}];function re(e){const t=e.trim();if(!t)return{primaryIdentifier:"",secondaryIdentifier:""};const r=t.split(/\s+/),n=r[r.length-1],o=r.slice(0,-1),i=o.length>0?o.join(" "):n;return{primaryIdentifier:n,secondaryIdentifier:i}}function ne(e,t,r=["1234567890"]){const n=t==null?void 0:t.map(o=>{const i={...o};return i.naturalPerson&&(i.naturalPerson={...i.naturalPerson,geographicAddress:I}),i.legalPerson&&(i.legalPerson={...i.legalPerson,geographicAddress:I}),i});return e==="originator"?{originatorPersons:n,accountNumber:r}:{beneficiaryPersons:n,accountNumber:r}}function oe(e,t="John Doe"){const{primaryIdentifier:r,secondaryIdentifier:n}=re(t),o={naturalPerson:{name:[{nameIdentifier:[{primaryIdentifier:r,...n?{secondaryIdentifier:n}:{},nameIdentifierType:"LEGL"}]}],geographicAddress:I}};return e==="originator"?{originatorPersons:[o],accountNumber:["1234567890"]}:{beneficiaryPersons:[o],accountNumber:["1234567890"]}}const ie=e=>({...e,name:e.name?[e.name]:void 0}),se=e=>({...e,naturalPerson:e.naturalPerson?ie(e.naturalPerson):void 0}),ae=({beneficiary:e,originator:t},r,n,o,i)=>{var s;{const a=e&&{...e,...o&&{accountNumber:[o]},beneficiaryPersons:(s=e.beneficiaryPersons)==null?void 0:s.map(se)};if(n&&(a!=null&&a.beneficiaryPersons)){const d=ne("originator",a==null?void 0:a.beneficiaryPersons);return{beneficiary:{accountNumber:d.accountNumber,beneficiaryPersons:d.originatorPersons},originator:d}}return{beneficiary:a,originator:oe("originator",r)}}};function ce(e,t,r){var i,s;const{beneficiary:n,originator:o}=ae(r,(i=e.customer)==null?void 0:i.name,t.originatorEqualsBeneficiary,e.destination);return{transactionAsset:t.transactionAsset,transactionAmount:t.transactionAmount,beneficiaryDid:(s=e.counterparty)==null?void 0:s.did,originatorVASPdid:t.originatorVASPdid,...t.beneficiaryVASPdid&&!t.beneficiaryProof?{beneficiaryVASPdid:t.beneficiaryVASPdid}:{},transactionBlockchainInfo:{...(o==null?void 0:o.accountNumber)&&{origin:o.accountNumber[0]},...e.destination&&{destination:e.destination}},...t.beneficiaryProof&&{beneficiaryProof:t.beneficiaryProof},...n&&{beneficiary:n},...o&&{originator:o},...t.originatorEqualsBeneficiary&&{originatorEqualsBeneficiary:t.originatorEqualsBeneficiary}}}function F(e,t,r={}){var m,f,A;const n=p(e),o=n?e.customer:e.counterparty,i=n?e.counterparty:e.customer,s=(r==null?void 0:r.originatorId)||g("originator",o),a=(r==null?void 0:r.beneficiaryId)||g("beneficiary",i),d=(r==null?void 0:r.referenceId)||t.transactionId||Math.random().toString(36).substring(2,15),l=[];return t.originatorVASPdid&&l.push({"@id":t.originatorVASPdid,for:s,role:"VASP"}),t.beneficiaryVASPdid&&l.push({"@id":t.beneficiaryVASPdid,for:a,role:"VASP"}),p(e)&&e.destination&&((m=e==null?void 0:e.account)!=null&&m.did)&&l.push({"@id":e.account.did,for:t.beneficiaryVASPdid||a,role:"SettlementAddress"}),N(e)&&e.source&&((f=e.agent)!=null&&f.did)&&l.push({"@id":e.agent.did,for:t.originatorVASPdid||s,role:"SourceAddress"}),{originator:{"@id":s},beneficiary:{"@id":a},asset:e.asset,amount:((A=e.amountDecimal)==null?void 0:A.toString())||t.transactionAmount,agents:l,ref:d}}function j(e,t,r={}){var i,s,a,d,l,m;if(p(e)){const f=r.beneficiaryId||g("beneficiary",e.counterparty),A=((i=e.counterparty)==null?void 0:i.type)===E.SELF&&r.originator?r.originator.originatorPerson:((a=(s=t.beneficiary)==null?void 0:s.beneficiaryPersons)==null?void 0:a.map($=>S($,f)))||[];return{ivms101:{originator:r.originator,beneficiary:{beneficiaryPerson:A}}}}const n=r.originatorId||g("originator",e.counterparty);return{ivms101:{originator:{originatorPerson:((d=e.counterparty)==null?void 0:d.type)===E.SELF&&r.beneficiary?r.beneficiary.beneficiaryPerson:((m=(l=t.originator)==null?void 0:l.originatorPersons)==null?void 0:m.map(f=>S(f,n)))||[]},beneficiary:r.beneficiary}}}function L(e,t,r){var i,s;const n={...e};let o;try{const a=ee(t);o=a==null?void 0:a.sub}catch{}return p(r)?(!n.originatorId&&o&&(n.originatorId=o),n.beneficiaryId||(((i=r.counterparty)==null?void 0:i.type)===E.SELF?n.beneficiaryId=n.originatorId:r.destination&&(n.beneficiaryId=`did:key:${r.destination}`))):N(r)&&(!n.beneficiaryId&&o&&(n.beneficiaryId=o),n.originatorId||(((s=r.counterparty)==null?void 0:s.type)===E.SELF?n.originatorId=n.beneficiaryId:r.source&&(n.originatorId=`did:key:${r.source}`))),n}function de(e){var s;if(!e.txCreate||!e.ivms101)throw new Error("Invalid response: missing required txCreate or ivms101 data");const{value:t,ivms101:r,proof:n,txCreate:o}=e,i={destination:(t==null?void 0:t.destination)||"",counterparty:(t==null?void 0:t.counterparty)||{},agent:t==null?void 0:t.agent,account:t==null?void 0:t.account,proof:n,asset:(t==null?void 0:t.asset)||(typeof o.transactionAsset=="string"?o.transactionAsset:(s=o.transactionAsset)==null?void 0:s.caip19)||"",amountDecimal:(t==null?void 0:t.amountDecimal)||(o.transactionAmount?parseFloat(o.transactionAmount):0),customer:t==null?void 0:t.customer};return ce(i,o,r)}function le(e,t,r={}){const{value:n,txCreate:o,txUpdate:i,ivms101:s,proof:a}=e,d=p(n)?o:i;if(!d||!s)throw new Error("Invalid response: missing required txCreate/txUpdate or ivms101 data");const l=L(r,t,n);return{createTx:F(n,d,l),ivms101:j(n,s,l),...a&&{confirmRelationship:{proof:a}}}}function ue(e,t,r={}){const{value:n,txCreate:o,txUpdate:i}=e,s=p(n)?o:i;if(!s||!e.ivms101)throw new Error("Invalid response: missing required txCreate/txUpdate or ivms101 data");const a=L(r,t,n);return F(n,s,a)}function he(e,t,r={}){if(!e.ivms101)throw new Error("Invalid response: missing required ivms101 data");const{value:n,ivms101:o}=e,i=L(r,t,n);return j(n,o,i)}async function R(e,t){const r=JSON.stringify(e),n=new TextEncoder,o=t?w(t):crypto.getRandomValues(new Uint8Array(32)),i=await crypto.subtle.importKey("raw",o,{name:"AES-GCM"},!1,["encrypt"]),s=crypto.getRandomValues(new Uint8Array(12)),a=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},i,n.encode(r));return{ciphertext:`${y(s)}-${y(a)}`,key:y(o)}}async function J({ciphertext:e,key:t}){const[r,n]=e.split("-"),o=new Uint8Array(atob(t).split("").map(m=>m.charCodeAt(0))),i=w(r),s=w(n),a=await crypto.subtle.importKey("raw",o,{name:"AES-GCM"},!1,["decrypt"]),d=new TextDecoder,l=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(i)},a,s);return JSON.parse(d.decode(l))}function y(e){const t=new Uint8Array(e);let r="";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return btoa(r)}function w(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}async function me(e){const t=await fetch(e.url,{method:"GET"});if(!t.ok)throw new Error(`Failed to get connection: ${await t.text()}`);const r=await t.json();if(!r.id||!r.metadata||!r.status||!r.sealed)throw new Error("Data missing from server response");const n={id:r.id,metadata:r.metadata,status:r.status};if(r.status==="closed")return n;const o=r.sealed[r.sealed.length-1],i=await J({ciphertext:o,key:e.key});return r.status==="completed"?{...n,result:i.result}:{...n,tx:i.tx}}class fe{constructor(t){c(this,"endpoint");this.endpoint=t}async create(t,r){const n=await R(t),o={metadata:r,sealed:n.ciphertext},i=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!i.ok)throw new Error(`Failed to create connection: ${await i.text()}`);const s=await i.json();return{id:s.id,version:s.version,status:s.status,metadata:r,data:t,key:n.key}}async update(t,r,n,o,i){const s=await R(r,i),a={sealed:s.ciphertext,version:n,status:o},d=await fetch(`${this.endpoint}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!d.ok)throw new Error(`Failed to update connection: ${await d.text()}`);const l=await d.json();return{id:l.id,metadata:l.metadata,version:l.version,status:l.status,data:r,key:s.key}}async get(t,r){const n=await fetch(`${this.endpoint}/${t}`,{method:"GET"});if(!n.ok)throw new Error(`Failed to get connection: ${await n.text()}`);const o=await n.json(),i=o.sealed[o.sealed.length-1],s=await J({ciphertext:i,key:r});return{id:o.id,status:o.status,version:o.version,metadata:o.metadata,data:s,key:r}}async close(t){const r=await fetch(`${this.endpoint}/${t}`,{method:"DELETE"});if(!r.ok)throw new Error(`Failed to close connection: ${await r.text()}`)}}class Ee{constructor(t){c(this,"nodeUrl");c(this,"authToken");c(this,"uxUrl");c(this,"theme");c(this,"locale");this.uxUrl=t.uxUrl||"https://connect.notabene.id",this.nodeUrl=t.nodeUrl,this.authToken=t.authToken,this.theme=t.theme,this.locale=t.locale}componentUrl(t,r,n,o){const i=new URL(this.uxUrl);i.pathname=t;const s=K({authToken:this.authToken,value:r,configuration:n});return i.hash=s,this.nodeUrl&&i.searchParams.set("nodeUrl",this.nodeUrl),this.theme&&i.searchParams.set("theme",JSON.stringify(this.theme)),this.locale&&i.searchParams.set("locale",this.locale),o&&(o.callback&&i.searchParams.set("callback_url",o.callback),o.redirectUri&&i.searchParams.set("redirect_uri",o.redirectUri)),i.toString()}createComponent(t,r,n,o){return new k(this.componentUrl(t,r,n,o),r,n)}createWithdrawalAssist(t,r,n){return this.createComponent("withdrawal-assist",t,r,n)}createConnectWallet(t,r,n){return this.createComponent("connect",t,r,n)}createDepositRequest(t,r,n){return this.createComponent("deposit-request",t,r,n)}createDepositAssist(t,r,n){return this.createComponent("deposit-assist",t,r,n)}}exports.AgentType=C;exports.CMType=u;exports.CodeVerificationStatus=_;exports.ConnectionManager=fe;exports.EmbeddedComponent=k;exports.ErrorIdentifierCode=x;exports.HMType=P;exports.IdentityVerificationMethod=O;exports.OAuthProvider=D;exports.PersonType=E;exports.ProofStatus=V;exports.ProofTypes=W;exports.Status=T;exports.VASPSearchControl=v;exports.ValidationSections=U;exports.WarningIdentifierCode=M;exports.componentResponseToIVMS101=he;exports.componentResponseToTxCreateRequest=ue;exports.componentResponseToTxRequests=le;exports.componentResponseToV1TxCreateRequest=de;exports.decodeFragmentToObject=X;exports.default=Ee;exports.getRefreshResult=me;
|
package/dist/cjs/notabene.d.ts
CHANGED
|
@@ -82,6 +82,11 @@ export declare enum AgentType {
|
|
|
82
82
|
VASP = "VASP"
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
declare interface BaseRequestConfig {
|
|
86
|
+
originatorId?: DID_2;
|
|
87
|
+
beneficiaryId?: DID_2;
|
|
88
|
+
}
|
|
89
|
+
|
|
85
90
|
/**
|
|
86
91
|
* Beneficiary
|
|
87
92
|
* Represents the receiver of the requested VA transfer
|
|
@@ -331,32 +336,45 @@ export declare interface ComponentResponse {
|
|
|
331
336
|
/**
|
|
332
337
|
* Transforms a Notabene component response to IVMS101 format
|
|
333
338
|
*
|
|
339
|
+
* ## IVMS101 Config by Transaction Type
|
|
340
|
+
*
|
|
341
|
+
* The `originator` and `beneficiary` config options provide the customer's PII data.
|
|
342
|
+
* Which one to use depends on the transaction type:
|
|
343
|
+
*
|
|
344
|
+
* - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
|
|
345
|
+
* - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
|
|
346
|
+
*
|
|
347
|
+
* For self-transfers, the provided data is automatically reused for both parties.
|
|
348
|
+
*
|
|
334
349
|
* @param response - The response from the Notabene Embedded Component
|
|
335
|
-
* @param delegateToken - The JWT delegate token for extracting the
|
|
350
|
+
* @param delegateToken - The JWT delegate token for extracting the customer ID
|
|
336
351
|
* @param config - Configuration object with optional IDs
|
|
337
|
-
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken
|
|
338
|
-
* @param config.beneficiaryId - Optional beneficiary ID (auto-
|
|
339
|
-
* @param config.
|
|
340
|
-
* @param config.
|
|
352
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
|
|
353
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
|
|
354
|
+
* @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
|
|
355
|
+
* @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
|
|
341
356
|
* @returns The transformed request body in IVMS101 format
|
|
342
357
|
*
|
|
343
358
|
* @example
|
|
344
359
|
* ```typescript
|
|
345
360
|
* import { componentResponseToIVMS101 } from '$lib/notabene-tx-transformer';
|
|
346
361
|
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
362
|
+
* // For withdrawals: pass originator (customer is sending)
|
|
363
|
+
* const withdrawalIvms = componentResponseToIVMS101(
|
|
364
|
+
* withdrawalResponse,
|
|
365
|
+
* delegateToken,
|
|
366
|
+
* { originator: customerIvmsData }
|
|
351
367
|
* );
|
|
352
368
|
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
369
|
+
* // For deposits: pass beneficiary (customer is receiving)
|
|
370
|
+
* const depositIvms = componentResponseToIVMS101(
|
|
371
|
+
* depositResponse,
|
|
372
|
+
* delegateToken,
|
|
373
|
+
* { beneficiary: customerIvmsData }
|
|
374
|
+
* );
|
|
357
375
|
* ```
|
|
358
376
|
*/
|
|
359
|
-
export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal>, delegateToken: string, config?:
|
|
377
|
+
export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToIVMS101RequestConfig): TransactionIVMS101Request;
|
|
360
378
|
|
|
361
379
|
/**
|
|
362
380
|
* Transforms a Notabene component response to a Version 2 transaction create API request body
|
|
@@ -373,9 +391,11 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
|
|
|
373
391
|
* ```typescript
|
|
374
392
|
* import { componentResponseToTxCreateRequest } from '$lib/notabene-tx-transformer';
|
|
375
393
|
*
|
|
376
|
-
* withdrawal
|
|
394
|
+
* // Works with both withdrawal and deposit responses
|
|
395
|
+
* transaction.on('complete', async (result) => {
|
|
377
396
|
* const requestBody = componentResponseToTxCreateRequest(
|
|
378
397
|
* result.response,
|
|
398
|
+
* delegateToken,
|
|
379
399
|
* {
|
|
380
400
|
* originatorId: 'mailto:user@example.com',
|
|
381
401
|
* beneficiaryId: 'urn:beneficiary:recipient',
|
|
@@ -390,7 +410,7 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
|
|
|
390
410
|
* });
|
|
391
411
|
* ```
|
|
392
412
|
*/
|
|
393
|
-
export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal>, delegateToken: string, config?:
|
|
413
|
+
export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxCreateRequestConfig): TransactionCreateRequestV2;
|
|
394
414
|
|
|
395
415
|
/**
|
|
396
416
|
* Transforms a Notabene component response into txCreate, IVMS101, and confirmRelationship request bodies
|
|
@@ -400,50 +420,50 @@ export declare function componentResponseToTxCreateRequest(response: Transaction
|
|
|
400
420
|
* which is useful for V2 workflows where you need to create a transaction first,
|
|
401
421
|
* then append IVMS101 data to it, and finally confirm the relationship.
|
|
402
422
|
*
|
|
423
|
+
* ## IVMS101 Config by Transaction Type
|
|
424
|
+
*
|
|
425
|
+
* The `originator` and `beneficiary` config options provide the customer's PII data.
|
|
426
|
+
* Which one to use depends on the transaction type:
|
|
427
|
+
*
|
|
428
|
+
* - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
|
|
429
|
+
* - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
|
|
430
|
+
*
|
|
431
|
+
* For self-transfers, the provided data is automatically reused for both parties.
|
|
432
|
+
*
|
|
403
433
|
* @param response - The response from the Notabene Embedded Component
|
|
404
|
-
* @param delegateToken - The JWT delegate token for extracting the
|
|
434
|
+
* @param delegateToken - The JWT delegate token for extracting the customer ID
|
|
405
435
|
* @param config - Optional configuration for IDs and reference
|
|
406
|
-
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken
|
|
407
|
-
* @param config.beneficiaryId - Optional beneficiary ID (auto-
|
|
436
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
|
|
437
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
|
|
408
438
|
* @param config.referenceId - Optional reference ID (auto-generated if not provided)
|
|
409
|
-
* @param config.originator -
|
|
439
|
+
* @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
|
|
440
|
+
* @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
|
|
410
441
|
* @returns Object with `createTx`, `ivms101`, and optional `confirmRelationship` properties containing the respective request bodies
|
|
411
442
|
*
|
|
412
443
|
* @example
|
|
413
444
|
* ```typescript
|
|
414
445
|
* import { componentResponseToTxRequests } from '$lib/notabene-tx-transformer';
|
|
415
446
|
*
|
|
447
|
+
* // For withdrawals: pass originator (customer is sending)
|
|
416
448
|
* withdrawal.on('complete', async (result) => {
|
|
417
|
-
* const { createTx, ivms101
|
|
449
|
+
* const { createTx, ivms101 } = componentResponseToTxRequests(
|
|
418
450
|
* result.response,
|
|
419
|
-
*
|
|
420
|
-
* { originator:
|
|
451
|
+
* delegateToken,
|
|
452
|
+
* { originator: customerIvmsData }
|
|
421
453
|
* );
|
|
454
|
+
* });
|
|
422
455
|
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* const txId = txResponse.transfer['@id'];
|
|
431
|
-
* await fetch(`/entity/${vaspDid}/tx/${txId}/append`, {
|
|
432
|
-
* method: 'POST',
|
|
433
|
-
* body: JSON.stringify(ivms101)
|
|
434
|
-
* });
|
|
435
|
-
*
|
|
436
|
-
* // Finally, confirm relationship
|
|
437
|
-
* if (confirmRelationship) {
|
|
438
|
-
* await fetch(`/entity/${vaspDid}/relationship?to=${to}&from=${from}`, {
|
|
439
|
-
* method: 'PATCH',
|
|
440
|
-
* body: JSON.stringify({ proof: confirmRelationship.proof })
|
|
441
|
-
* });
|
|
442
|
-
* }
|
|
456
|
+
* // For deposits: pass beneficiary (customer is receiving)
|
|
457
|
+
* deposit.on('complete', async (result) => {
|
|
458
|
+
* const { createTx, ivms101 } = componentResponseToTxRequests(
|
|
459
|
+
* result.response,
|
|
460
|
+
* delegateToken,
|
|
461
|
+
* { beneficiary: customerIvmsData }
|
|
462
|
+
* );
|
|
443
463
|
* });
|
|
444
464
|
* ```
|
|
445
465
|
*/
|
|
446
|
-
export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: ResponseToTxRequestConfig): {
|
|
466
|
+
export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxRequestConfig): {
|
|
447
467
|
createTx: TransactionCreateRequestV2;
|
|
448
468
|
ivms101: TransactionIVMS101Request;
|
|
449
469
|
confirmRelationship?: {
|
|
@@ -1612,7 +1632,6 @@ export declare enum ProofStatus {
|
|
|
1612
1632
|
* - ED25519: Ed25519 signature (used in Solana)
|
|
1613
1633
|
* - XRP_ED25519: Ed25519 signature (used in XRP)
|
|
1614
1634
|
* - XLM_ED25519: Ed25519 signature (used in Stellar)
|
|
1615
|
-
* - XPUB: Extended public key signature for HD wallets
|
|
1616
1635
|
* - MicroTransfer: Proof via small blockchain transaction
|
|
1617
1636
|
* - Screenshot: Image proof of ownership/access
|
|
1618
1637
|
* - CIP8: Cardano message signing standard (CIP-8)
|
|
@@ -1633,7 +1652,6 @@ export declare enum ProofTypes {
|
|
|
1633
1652
|
EIP1271 = "eip-1271",
|
|
1634
1653
|
BIP137 = "bip-137",
|
|
1635
1654
|
BIP322 = "bip-322",
|
|
1636
|
-
BIP137_XPUB = "xpub",
|
|
1637
1655
|
TIP191 = "tip-191",
|
|
1638
1656
|
ED25519 = "ed25519",
|
|
1639
1657
|
XRP_ED25519 = "xrp-ed25519",
|
|
@@ -1674,13 +1692,17 @@ export declare type ResizeRequest = {
|
|
|
1674
1692
|
height: number;
|
|
1675
1693
|
};
|
|
1676
1694
|
|
|
1677
|
-
|
|
1678
|
-
originatorId?: DID_2;
|
|
1679
|
-
beneficiaryId?: DID_2;
|
|
1680
|
-
referenceId?: string;
|
|
1695
|
+
declare interface ResponseToIVMS101RequestConfig extends BaseRequestConfig {
|
|
1681
1696
|
originator?: OriginatorV2;
|
|
1697
|
+
beneficiary?: BeneficiaryV2;
|
|
1682
1698
|
}
|
|
1683
1699
|
|
|
1700
|
+
declare interface ResponseToTxCreateRequestConfig extends BaseRequestConfig {
|
|
1701
|
+
referenceId?: string;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
export declare type ResponseToTxRequestConfig = ResponseToTxCreateRequestConfig & ResponseToIVMS101RequestConfig;
|
|
1705
|
+
|
|
1684
1706
|
/**
|
|
1685
1707
|
* Ownership Proof using Screenshot
|
|
1686
1708
|
* @public
|
|
@@ -1708,7 +1730,7 @@ export declare interface ScreenshotProof extends OwnershipProof {
|
|
|
1708
1730
|
* @public
|
|
1709
1731
|
*/
|
|
1710
1732
|
export declare interface SignatureProof extends OwnershipProof {
|
|
1711
|
-
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.
|
|
1733
|
+
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519 | ProofTypes.COSMOS;
|
|
1712
1734
|
proof: string;
|
|
1713
1735
|
attestation: string;
|
|
1714
1736
|
wallet_provider: string;
|
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.14.
|
|
13
|
+
"version": "2.14.1-next.1",
|
|
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
|
@@ -82,6 +82,11 @@ export declare enum AgentType {
|
|
|
82
82
|
VASP = "VASP"
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
declare interface BaseRequestConfig {
|
|
86
|
+
originatorId?: DID_2;
|
|
87
|
+
beneficiaryId?: DID_2;
|
|
88
|
+
}
|
|
89
|
+
|
|
85
90
|
/**
|
|
86
91
|
* Beneficiary
|
|
87
92
|
* Represents the receiver of the requested VA transfer
|
|
@@ -331,32 +336,45 @@ export declare interface ComponentResponse {
|
|
|
331
336
|
/**
|
|
332
337
|
* Transforms a Notabene component response to IVMS101 format
|
|
333
338
|
*
|
|
339
|
+
* ## IVMS101 Config by Transaction Type
|
|
340
|
+
*
|
|
341
|
+
* The `originator` and `beneficiary` config options provide the customer's PII data.
|
|
342
|
+
* Which one to use depends on the transaction type:
|
|
343
|
+
*
|
|
344
|
+
* - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
|
|
345
|
+
* - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
|
|
346
|
+
*
|
|
347
|
+
* For self-transfers, the provided data is automatically reused for both parties.
|
|
348
|
+
*
|
|
334
349
|
* @param response - The response from the Notabene Embedded Component
|
|
335
|
-
* @param delegateToken - The JWT delegate token for extracting the
|
|
350
|
+
* @param delegateToken - The JWT delegate token for extracting the customer ID
|
|
336
351
|
* @param config - Configuration object with optional IDs
|
|
337
|
-
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken
|
|
338
|
-
* @param config.beneficiaryId - Optional beneficiary ID (auto-
|
|
339
|
-
* @param config.
|
|
340
|
-
* @param config.
|
|
352
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
|
|
353
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
|
|
354
|
+
* @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
|
|
355
|
+
* @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
|
|
341
356
|
* @returns The transformed request body in IVMS101 format
|
|
342
357
|
*
|
|
343
358
|
* @example
|
|
344
359
|
* ```typescript
|
|
345
360
|
* import { componentResponseToIVMS101 } from '$lib/notabene-tx-transformer';
|
|
346
361
|
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
362
|
+
* // For withdrawals: pass originator (customer is sending)
|
|
363
|
+
* const withdrawalIvms = componentResponseToIVMS101(
|
|
364
|
+
* withdrawalResponse,
|
|
365
|
+
* delegateToken,
|
|
366
|
+
* { originator: customerIvmsData }
|
|
351
367
|
* );
|
|
352
368
|
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
369
|
+
* // For deposits: pass beneficiary (customer is receiving)
|
|
370
|
+
* const depositIvms = componentResponseToIVMS101(
|
|
371
|
+
* depositResponse,
|
|
372
|
+
* delegateToken,
|
|
373
|
+
* { beneficiary: customerIvmsData }
|
|
374
|
+
* );
|
|
357
375
|
* ```
|
|
358
376
|
*/
|
|
359
|
-
export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal>, delegateToken: string, config?:
|
|
377
|
+
export declare function componentResponseToIVMS101(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToIVMS101RequestConfig): TransactionIVMS101Request;
|
|
360
378
|
|
|
361
379
|
/**
|
|
362
380
|
* Transforms a Notabene component response to a Version 2 transaction create API request body
|
|
@@ -373,9 +391,11 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
|
|
|
373
391
|
* ```typescript
|
|
374
392
|
* import { componentResponseToTxCreateRequest } from '$lib/notabene-tx-transformer';
|
|
375
393
|
*
|
|
376
|
-
* withdrawal
|
|
394
|
+
* // Works with both withdrawal and deposit responses
|
|
395
|
+
* transaction.on('complete', async (result) => {
|
|
377
396
|
* const requestBody = componentResponseToTxCreateRequest(
|
|
378
397
|
* result.response,
|
|
398
|
+
* delegateToken,
|
|
379
399
|
* {
|
|
380
400
|
* originatorId: 'mailto:user@example.com',
|
|
381
401
|
* beneficiaryId: 'urn:beneficiary:recipient',
|
|
@@ -390,7 +410,7 @@ export declare function componentResponseToIVMS101(response: TransactionResponse
|
|
|
390
410
|
* });
|
|
391
411
|
* ```
|
|
392
412
|
*/
|
|
393
|
-
export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal>, delegateToken: string, config?:
|
|
413
|
+
export declare function componentResponseToTxCreateRequest(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxCreateRequestConfig): TransactionCreateRequestV2;
|
|
394
414
|
|
|
395
415
|
/**
|
|
396
416
|
* Transforms a Notabene component response into txCreate, IVMS101, and confirmRelationship request bodies
|
|
@@ -400,50 +420,50 @@ export declare function componentResponseToTxCreateRequest(response: Transaction
|
|
|
400
420
|
* which is useful for V2 workflows where you need to create a transaction first,
|
|
401
421
|
* then append IVMS101 data to it, and finally confirm the relationship.
|
|
402
422
|
*
|
|
423
|
+
* ## IVMS101 Config by Transaction Type
|
|
424
|
+
*
|
|
425
|
+
* The `originator` and `beneficiary` config options provide the customer's PII data.
|
|
426
|
+
* Which one to use depends on the transaction type:
|
|
427
|
+
*
|
|
428
|
+
* - **Withdrawals**: Pass `originator` - the customer is sending funds (customer = originator)
|
|
429
|
+
* - **Deposits**: Pass `beneficiary` - the customer is receiving funds (customer = beneficiary)
|
|
430
|
+
*
|
|
431
|
+
* For self-transfers, the provided data is automatically reused for both parties.
|
|
432
|
+
*
|
|
403
433
|
* @param response - The response from the Notabene Embedded Component
|
|
404
|
-
* @param delegateToken - The JWT delegate token for extracting the
|
|
434
|
+
* @param delegateToken - The JWT delegate token for extracting the customer ID
|
|
405
435
|
* @param config - Optional configuration for IDs and reference
|
|
406
|
-
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken
|
|
407
|
-
* @param config.beneficiaryId - Optional beneficiary ID (auto-
|
|
436
|
+
* @param config.originatorId - Optional originator ID (auto-extracted from delegateToken for withdrawals)
|
|
437
|
+
* @param config.beneficiaryId - Optional beneficiary ID (auto-extracted from delegateToken for deposits)
|
|
408
438
|
* @param config.referenceId - Optional reference ID (auto-generated if not provided)
|
|
409
|
-
* @param config.originator -
|
|
439
|
+
* @param config.originator - Customer's IVMS101 data for withdrawals (customer is the sender)
|
|
440
|
+
* @param config.beneficiary - Customer's IVMS101 data for deposits (customer is the receiver)
|
|
410
441
|
* @returns Object with `createTx`, `ivms101`, and optional `confirmRelationship` properties containing the respective request bodies
|
|
411
442
|
*
|
|
412
443
|
* @example
|
|
413
444
|
* ```typescript
|
|
414
445
|
* import { componentResponseToTxRequests } from '$lib/notabene-tx-transformer';
|
|
415
446
|
*
|
|
447
|
+
* // For withdrawals: pass originator (customer is sending)
|
|
416
448
|
* withdrawal.on('complete', async (result) => {
|
|
417
|
-
* const { createTx, ivms101
|
|
449
|
+
* const { createTx, ivms101 } = componentResponseToTxRequests(
|
|
418
450
|
* result.response,
|
|
419
|
-
*
|
|
420
|
-
* { originator:
|
|
451
|
+
* delegateToken,
|
|
452
|
+
* { originator: customerIvmsData }
|
|
421
453
|
* );
|
|
454
|
+
* });
|
|
422
455
|
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
* const txId = txResponse.transfer['@id'];
|
|
431
|
-
* await fetch(`/entity/${vaspDid}/tx/${txId}/append`, {
|
|
432
|
-
* method: 'POST',
|
|
433
|
-
* body: JSON.stringify(ivms101)
|
|
434
|
-
* });
|
|
435
|
-
*
|
|
436
|
-
* // Finally, confirm relationship
|
|
437
|
-
* if (confirmRelationship) {
|
|
438
|
-
* await fetch(`/entity/${vaspDid}/relationship?to=${to}&from=${from}`, {
|
|
439
|
-
* method: 'PATCH',
|
|
440
|
-
* body: JSON.stringify({ proof: confirmRelationship.proof })
|
|
441
|
-
* });
|
|
442
|
-
* }
|
|
456
|
+
* // For deposits: pass beneficiary (customer is receiving)
|
|
457
|
+
* deposit.on('complete', async (result) => {
|
|
458
|
+
* const { createTx, ivms101 } = componentResponseToTxRequests(
|
|
459
|
+
* result.response,
|
|
460
|
+
* delegateToken,
|
|
461
|
+
* { beneficiary: customerIvmsData }
|
|
462
|
+
* );
|
|
443
463
|
* });
|
|
444
464
|
* ```
|
|
445
465
|
*/
|
|
446
|
-
export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal>, delegateToken: string, config?: ResponseToTxRequestConfig): {
|
|
466
|
+
export declare function componentResponseToTxRequests(response: TransactionResponse<Withdrawal | Deposit>, delegateToken: string, config?: ResponseToTxRequestConfig): {
|
|
447
467
|
createTx: TransactionCreateRequestV2;
|
|
448
468
|
ivms101: TransactionIVMS101Request;
|
|
449
469
|
confirmRelationship?: {
|
|
@@ -1612,7 +1632,6 @@ export declare enum ProofStatus {
|
|
|
1612
1632
|
* - ED25519: Ed25519 signature (used in Solana)
|
|
1613
1633
|
* - XRP_ED25519: Ed25519 signature (used in XRP)
|
|
1614
1634
|
* - XLM_ED25519: Ed25519 signature (used in Stellar)
|
|
1615
|
-
* - XPUB: Extended public key signature for HD wallets
|
|
1616
1635
|
* - MicroTransfer: Proof via small blockchain transaction
|
|
1617
1636
|
* - Screenshot: Image proof of ownership/access
|
|
1618
1637
|
* - CIP8: Cardano message signing standard (CIP-8)
|
|
@@ -1633,7 +1652,6 @@ export declare enum ProofTypes {
|
|
|
1633
1652
|
EIP1271 = "eip-1271",
|
|
1634
1653
|
BIP137 = "bip-137",
|
|
1635
1654
|
BIP322 = "bip-322",
|
|
1636
|
-
BIP137_XPUB = "xpub",
|
|
1637
1655
|
TIP191 = "tip-191",
|
|
1638
1656
|
ED25519 = "ed25519",
|
|
1639
1657
|
XRP_ED25519 = "xrp-ed25519",
|
|
@@ -1674,13 +1692,17 @@ export declare type ResizeRequest = {
|
|
|
1674
1692
|
height: number;
|
|
1675
1693
|
};
|
|
1676
1694
|
|
|
1677
|
-
|
|
1678
|
-
originatorId?: DID_2;
|
|
1679
|
-
beneficiaryId?: DID_2;
|
|
1680
|
-
referenceId?: string;
|
|
1695
|
+
declare interface ResponseToIVMS101RequestConfig extends BaseRequestConfig {
|
|
1681
1696
|
originator?: OriginatorV2;
|
|
1697
|
+
beneficiary?: BeneficiaryV2;
|
|
1682
1698
|
}
|
|
1683
1699
|
|
|
1700
|
+
declare interface ResponseToTxCreateRequestConfig extends BaseRequestConfig {
|
|
1701
|
+
referenceId?: string;
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
export declare type ResponseToTxRequestConfig = ResponseToTxCreateRequestConfig & ResponseToIVMS101RequestConfig;
|
|
1705
|
+
|
|
1684
1706
|
/**
|
|
1685
1707
|
* Ownership Proof using Screenshot
|
|
1686
1708
|
* @public
|
|
@@ -1708,7 +1730,7 @@ export declare interface ScreenshotProof extends OwnershipProof {
|
|
|
1708
1730
|
* @public
|
|
1709
1731
|
*/
|
|
1710
1732
|
export declare interface SignatureProof extends OwnershipProof {
|
|
1711
|
-
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.
|
|
1733
|
+
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519 | ProofTypes.COSMOS;
|
|
1712
1734
|
proof: string;
|
|
1713
1735
|
attestation: string;
|
|
1714
1736
|
wallet_provider: string;
|