@notabene/javascript-sdk 2.11.0 → 2.12.0
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 +62 -11
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +62 -11
- package/dist/esm/notabene.js +190 -187
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +62 -11
- package/dist/notabene.js +190 -187
- package/package.json +1 -1
- package/src/notabene.ts +8 -0
- package/src/types.ts +59 -14
- package/src/utils/connections.ts +2 -0
package/dist/cjs/notabene.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var U=Object.defineProperty;var _=(t,e,n)=>e in t?U(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var a=(t,e,n)=>_(t,typeof e!="symbol"?e+"":e,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var f=(t=>(t.PRIVATE="WALLET",t.VASP="VASP",t))(f||{}),w=(t=>(t.NATURAL="natural",t.LEGAL="legal",t.SELF="self",t))(w||{}),g=(t=>(t.EMPTY="empty",t.VERIFY="verify",t.PENDING="pending",t.VERIFIED="verified",t.BANNED="banned",t))(g||{}),v=(t=>(t.ALLOWED="allowed",t.PENDING="pending",t))(v||{}),A=(t=>(t.ASSET="asset",t.DESTINATION="destination",t.COUNTERPARTY="counterparty",t.AGENT="agent",t))(A||{}),l=(t=>(t.COMPLETE="complete",t.RESIZE="resize",t.RESULT="result",t.READY="ready",t.INVALID="invalid",t.ERROR="error",t.CANCEL="cancel",t.WARNING="warning",t.INFO="info",t))(l||{}),y=(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))(y||{}),p=(t=>(t.UPDATE="update",t.REQUEST_RESPONSE="requestResponse",t))(p||{}),I=(t=>(t.PENDING="pending",t.FAILED="rejected",t.FLAGGED="flagged",t.VERIFIED="verified",t))(I||{}),C=(t=>(t.SelfDeclaration="self-declaration",t.SIWE="siwe",t.SIWX="siwx",t.SOL_SIWX="sol-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.XLM_ED25519="xlm-ed25519",t.CIP8="cip-8",t.MicroTransfer="microtransfer",t.Screenshot="screenshot",t.Connect="connect",t.CONCORDIUM="concordium",t))(C||{});class R{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,s=this.listeners.get(r);s&&s.forEach(i=>i(n))}}send(e){this.port&&this.port.postMessage(e)}}class b{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 R,this.on(l.INVALID,s=>{s.type===l.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(l.RESIZE,s=>{s.type===l.RESIZE&&this.iframe&&(this.iframe.style.height=`${s.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,s;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",i=>{var o,c;i.source===((o=this.iframe)==null?void 0:o.contentWindow)&&((c=this.eventManager)==null||c.setPort(i.ports[0]))}),(s=(r=this.iframe)==null?void 0:r.contentWindow)==null||s.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:p.UPDATE,value:e,options:this._options})}completion(){return new Promise((e,n)=>{let r,s,i;function o(){r&&r(),s&&s(),i&&i()}r=this.on(l.COMPLETE,c=>{e(c.response),o()}),s=this.on(l.CANCEL,()=>{n(new Error("User cancelled")),o()}),i=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",s=>{var i;s.source===e&&(console.log("received message from popup",s.data),(i=this.eventManager)==null||i.setPort(s.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 O(t){return Object.entries(t).map(([e,n])=>{if(n==null)return;const r=encodeURIComponent(e),s=encodeURIComponent(typeof n=="object"?JSON.stringify(n):String(n));return`${r}=${s}`}).filter(e=>e!==void 0).join("&")}function S(t){const e=t.slice(1);return e?e.split("&").filter(Boolean).reduce((r,s)=>{const[i,o]=s.split("=");return i&&(r[decodeURIComponent(i)]=o?decodeURIComponent(o):""),r},{}):{}}async function E(t,e){const n=JSON.stringify(t),r=new TextEncoder,s=e?m(e):crypto.getRandomValues(new Uint8Array(32)),i=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["encrypt"]),o=crypto.getRandomValues(new Uint8Array(12)),c=await crypto.subtle.encrypt({name:"AES-GCM",iv:o},i,r.encode(n));return{ciphertext:`${u(o)}-${u(c)}`,key:u(s)}}async function N({ciphertext:t,key:e}){const[n,r]=t.split("-"),s=new Uint8Array(atob(e).split("").map(L=>L.charCodeAt(0))),i=m(n),o=m(r),c=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["decrypt"]),d=new TextDecoder,h=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(i)},c,o);return JSON.parse(d.decode(h))}function u(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}async function x(t){const e=await fetch(t.url,{method:"GET"});if(!e.ok)throw new Error(`Failed to get connection: ${await e.text()}`);const n=await e.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 s=n.sealed[n.sealed.length-1],i=await N({ciphertext:s,key:t.key});return n.status==="completed"?{...r,result:i.result}:{...r,tx:i.tx}}class D{constructor(e){a(this,"endpoint");this.endpoint=e}async create(e,n){const r=await E(e),s={metadata:n,sealed:r.ciphertext},i=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok)throw new Error(`Failed to create connection: ${await i.text()}`);const o=await i.json();return{id:o.id,version:o.version,status:o.status,metadata:n,data:e,key:r.key}}async update(e,n,r,s,i){const o=await E(n,i),c={sealed:o.ciphertext,version:r,status:s},d=await fetch(`${this.endpoint}/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});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:o.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 s=await r.json(),i=s.sealed[s.sealed.length-1],o=await N({ciphertext:i,key:n});return{id:s.id,status:s.status,version:s.version,metadata:s.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 M{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,s){const i=new URL(this.uxUrl);i.pathname=e;const o=O({authToken:this.authToken,value:n,configuration:r});return i.hash=o,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),s&&(s.callback&&i.searchParams.set("callback_url",s.callback),s.redirectUri&&i.searchParams.set("redirect_uri",s.redirectUri)),i.toString()}createComponent(e,n,r,s){return new b(this.componentUrl(e,n,r,s),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=f;exports.CMType=l;exports.ConnectionManager=D;exports.EmbeddedComponent=b;exports.ErrorIdentifierCode=y;exports.HMType=p;exports.PersonType=w;exports.ProofStatus=I;exports.ProofTypes=C;exports.Status=g;exports.VASPSearchControl=v;exports.ValidationSections=A;exports.decodeFragmentToObject=S;exports.default=M;exports.getRefreshResult=x;
|
|
1
|
+
"use strict";var U=Object.defineProperty;var D=(e,t,n)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var a=(e,t,n)=>D(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var f=(e=>(e.PRIVATE="WALLET",e.VASP="VASP",e))(f||{}),w=(e=>(e.NATURAL="natural",e.LEGAL="legal",e.SELF="self",e))(w||{}),A=(e=>(e.EMPTY="empty",e.VERIFY="verify",e.PENDING="pending",e.VERIFIED="verified",e.BANNED="banned",e))(A||{}),v=(e=>(e.ALLOWED="allowed",e.PENDING="pending",e))(v||{}),g=(e=>(e.SMS="sms",e.EMAIL="email",e))(g||{}),I=(e=>(e.PENDING="pending",e.APPROVED="approved",e.FAILED="failed",e.EXPIRED="expired",e.MAX_ATTEMPTS_REACHED="max_attempts_reached",e.UNREACHABLE="unreachable",e))(I||{}),y=(e=>(e.COINBASE="coinbase",e))(y||{}),N=(e=>(e.ASSET="asset",e.DESTINATION="destination",e.COUNTERPARTY="counterparty",e.AGENT="agent",e))(N||{}),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||{}),b=(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))(b||{}),E=(e=>(e.UPDATE="update",e.REQUEST_RESPONSE="requestResponse",e))(E||{}),C=(e=>(e.PENDING="pending",e.FAILED="rejected",e.FLAGGED="flagged",e.VERIFIED="verified",e))(C||{}),L=(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))(L||{});class S{constructor(){a(this,"listeners",new Map);a(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,s=this.listeners.get(r);s&&s.forEach(i=>i(n))}}send(t){this.port&&this.port.postMessage(t)}}class _{constructor(t,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=t,this._value=n,this._options=r,this.eventManager=new S,this.on(l.INVALID,s=>{s.type===l.INVALID&&(this._errors=s.errors,this._value=s.value)}),this.on(l.RESIZE,s=>{s.type===l.RESIZE&&this.iframe&&(this.iframe.style.height=`${s.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,s;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 o,c;i.source===((o=this.iframe)==null?void 0:o.contentWindow)&&((c=this.eventManager)==null||c.setPort(i.ports[0]))}),(s=(r=this.iframe)==null?void 0:r.contentWindow)==null||s.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:E.UPDATE,value:t,options:this._options})}completion(){return new Promise((t,n)=>{let r,s,i;function o(){r&&r(),s&&s(),i&&i()}r=this.on(l.COMPLETE,c=>{t(c.response),o()}),s=this.on(l.CANCEL,()=>{n(new Error("User cancelled")),o()}),i=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 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",s=>{var i;s.source===t&&(console.log("received message from popup",s.data),(i=this.eventManager)==null||i.setPort(s.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 x(e){return Object.entries(e).map(([t,n])=>{if(n==null)return;const r=encodeURIComponent(t),s=encodeURIComponent(typeof n=="object"?JSON.stringify(n):String(n));return`${r}=${s}`}).filter(t=>t!==void 0).join("&")}function M(e){const t=e.slice(1);return t?t.split("&").filter(Boolean).reduce((r,s)=>{const[i,o]=s.split("=");return i&&(r[decodeURIComponent(i)]=o?decodeURIComponent(o):""),r},{}):{}}async function p(e,t){const n=JSON.stringify(e),r=new TextEncoder,s=t?m(t):crypto.getRandomValues(new Uint8Array(32)),i=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["encrypt"]),o=crypto.getRandomValues(new Uint8Array(12)),c=await crypto.subtle.encrypt({name:"AES-GCM",iv:o},i,r.encode(n));return{ciphertext:`${u(o)}-${u(c)}`,key:u(s)}}async function O({ciphertext:e,key:t}){const[n,r]=e.split("-"),s=new Uint8Array(atob(t).split("").map(R=>R.charCodeAt(0))),i=m(n),o=m(r),c=await crypto.subtle.importKey("raw",s,{name:"AES-GCM"},!1,["decrypt"]),d=new TextDecoder,h=await crypto.subtle.decrypt({name:"AES-GCM",iv:new Uint8Array(i)},c,o);return JSON.parse(d.decode(h))}function u(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 m(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 P(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 s=n.sealed[n.sealed.length-1],i=await O({ciphertext:s,key:e.key});return n.status==="completed"?{...r,result:i.result}:{...r,tx:i.tx}}class T{constructor(t){a(this,"endpoint");this.endpoint=t}async create(t,n){const r=await p(t),s={metadata:n,sealed:r.ciphertext},i=await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok)throw new Error(`Failed to create connection: ${await i.text()}`);const o=await i.json();return{id:o.id,version:o.version,status:o.status,metadata:n,data:t,key:r.key}}async update(t,n,r,s,i){const o=await p(n,i),c={sealed:o.ciphertext,version:r,status:s},d=await fetch(`${this.endpoint}/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});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:o.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 s=await r.json(),i=s.sealed[s.sealed.length-1],o=await O({ciphertext:i,key:n});return{id:s.id,status:s.status,version:s.version,metadata:s.metadata,data:o,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 k{constructor(t){a(this,"nodeUrl");a(this,"authToken");a(this,"uxUrl");a(this,"theme");a(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,s){const i=new URL(this.uxUrl);i.pathname=t;const o=x({authToken:this.authToken,value:n,configuration:r});return i.hash=o,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),s&&(s.callback&&i.searchParams.set("callback_url",s.callback),s.redirectUri&&i.searchParams.set("redirect_uri",s.redirectUri)),i.toString()}createComponent(t,n,r,s){return new _(this.componentUrl(t,n,r,s),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=f;exports.CMType=l;exports.CodeVerificationStatus=I;exports.ConnectionManager=T;exports.EmbeddedComponent=_;exports.ErrorIdentifierCode=b;exports.HMType=E;exports.IdentityVerificationMethod=g;exports.OAuthProvider=y;exports.PersonType=w;exports.ProofStatus=C;exports.ProofTypes=L;exports.Status=A;exports.VASPSearchControl=v;exports.ValidationSections=N;exports.decodeFragmentToObject=M;exports.default=k;exports.getRefreshResult=P;
|
package/dist/cjs/notabene.d.ts
CHANGED
|
@@ -223,6 +223,19 @@ export declare enum CMType {
|
|
|
223
223
|
INFO = "info"
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Status of a code verification
|
|
228
|
+
* @public
|
|
229
|
+
*/
|
|
230
|
+
export declare enum CodeVerificationStatus {
|
|
231
|
+
PENDING = "pending",
|
|
232
|
+
APPROVED = "approved",
|
|
233
|
+
FAILED = "failed",
|
|
234
|
+
EXPIRED = "expired",
|
|
235
|
+
MAX_ATTEMPTS_REACHED = "max_attempts_reached",
|
|
236
|
+
UNREACHABLE = "unreachable"
|
|
237
|
+
}
|
|
238
|
+
|
|
226
239
|
/**
|
|
227
240
|
* Represents a completed component message
|
|
228
241
|
* @typeParam T - The overall Value type being returned
|
|
@@ -312,6 +325,8 @@ export declare interface ConnectionData<T extends ComponentRequest> {
|
|
|
312
325
|
readonly authToken?: string;
|
|
313
326
|
readonly txOptions?: TransactionOptions;
|
|
314
327
|
readonly result?: TransactionResponse<T>;
|
|
328
|
+
readonly phoneNumber?: string;
|
|
329
|
+
readonly email?: string;
|
|
315
330
|
}
|
|
316
331
|
|
|
317
332
|
/**
|
|
@@ -403,6 +418,19 @@ export declare type ConnectionResult<T extends ComponentRequest> = {
|
|
|
403
418
|
|
|
404
419
|
export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
|
|
405
420
|
|
|
421
|
+
/**
|
|
422
|
+
* Metadata for Cosmos ownership proofs
|
|
423
|
+
* @remarks
|
|
424
|
+
* - Includes the public key
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
427
|
+
export declare interface CosmosMetadata {
|
|
428
|
+
pub_key: {
|
|
429
|
+
type: string;
|
|
430
|
+
value: string;
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
406
434
|
/**
|
|
407
435
|
* The counterparty of a transaction.
|
|
408
436
|
* @public
|
|
@@ -452,6 +480,7 @@ export declare interface Counterparty {
|
|
|
452
480
|
*/
|
|
453
481
|
export declare type CounterpartyAssistConfig = boolean | {
|
|
454
482
|
counterpartyTypes: PersonType[];
|
|
483
|
+
identityVerification?: IdentityVerificationConfig;
|
|
455
484
|
};
|
|
456
485
|
|
|
457
486
|
/**
|
|
@@ -494,7 +523,7 @@ export declare function decodeFragmentToObject(fragment: string): Record<string,
|
|
|
494
523
|
* An object representing a deposit transaction
|
|
495
524
|
* @public
|
|
496
525
|
*/
|
|
497
|
-
export declare interface Deposit extends OriginatorFields,
|
|
526
|
+
export declare interface Deposit extends OriginatorFields, Transaction, Refreshable {
|
|
498
527
|
}
|
|
499
528
|
|
|
500
529
|
/**
|
|
@@ -524,14 +553,6 @@ export declare interface DepositRequestOptions {
|
|
|
524
553
|
showQrCode?: boolean;
|
|
525
554
|
}
|
|
526
555
|
|
|
527
|
-
/**
|
|
528
|
-
* Extended transaction interface for deposits
|
|
529
|
-
* @public
|
|
530
|
-
*/
|
|
531
|
-
declare interface DepositTransaction extends Transaction {
|
|
532
|
-
transactionId?: string;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
556
|
/**
|
|
536
557
|
* The destination of a transaction either a blockchain address, a CAIP-19 address, or a travel address.
|
|
537
558
|
* @public
|
|
@@ -737,6 +758,26 @@ export declare enum HMType {
|
|
|
737
758
|
*/
|
|
738
759
|
export declare type HostMessage<T, O> = UpdateValue<T, O>;
|
|
739
760
|
|
|
761
|
+
/**
|
|
762
|
+
* Configuration options for identity verification
|
|
763
|
+
* @public
|
|
764
|
+
*/
|
|
765
|
+
declare type IdentityVerificationConfig = {
|
|
766
|
+
/** The required verification method. If not specified, none will be used */
|
|
767
|
+
requiredMethod?: IdentityVerificationMethod;
|
|
768
|
+
/** OAuth provider(s) to use for authentication. Can be a single provider or array of providers */
|
|
769
|
+
oAuth?: OAuthProvider[] | OAuthProvider;
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Available methods for identity verification
|
|
774
|
+
* @public
|
|
775
|
+
*/
|
|
776
|
+
export declare enum IdentityVerificationMethod {
|
|
777
|
+
SMS = "sms",
|
|
778
|
+
EMAIL = "email"
|
|
779
|
+
}
|
|
780
|
+
|
|
740
781
|
/**
|
|
741
782
|
* Represents an info component message
|
|
742
783
|
* @param message - Info message
|
|
@@ -1232,6 +1273,14 @@ export declare interface NotabeneConfig {
|
|
|
1232
1273
|
locale?: string;
|
|
1233
1274
|
}
|
|
1234
1275
|
|
|
1276
|
+
/**
|
|
1277
|
+
* Supported OAuth providers for authentication
|
|
1278
|
+
* @public
|
|
1279
|
+
*/
|
|
1280
|
+
export declare enum OAuthProvider {
|
|
1281
|
+
COINBASE = "coinbase"
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1235
1284
|
/**
|
|
1236
1285
|
* Originating VASP
|
|
1237
1286
|
* Represents the VASP which initiates the VA transfer
|
|
@@ -1413,6 +1462,7 @@ export declare enum ProofTypes {
|
|
|
1413
1462
|
XRP_ED25519 = "xrp-ed25519",
|
|
1414
1463
|
XLM_ED25519 = "xlm-ed25519",
|
|
1415
1464
|
CIP8 = "cip-8",
|
|
1465
|
+
COSMOS = "cosmos-ecdsa",
|
|
1416
1466
|
MicroTransfer = "microtransfer",
|
|
1417
1467
|
Screenshot = "screenshot",
|
|
1418
1468
|
Connect = "connect",
|
|
@@ -1474,14 +1524,14 @@ export declare interface ScreenshotProof extends OwnershipProof {
|
|
|
1474
1524
|
* @public
|
|
1475
1525
|
*/
|
|
1476
1526
|
export declare interface SignatureProof extends OwnershipProof {
|
|
1477
|
-
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.BIP137_XPUB | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519;
|
|
1527
|
+
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.BIP137_XPUB | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519 | ProofTypes.COSMOS;
|
|
1478
1528
|
proof: string;
|
|
1479
1529
|
attestation: string;
|
|
1480
1530
|
wallet_provider: string;
|
|
1481
1531
|
xpub?: string;
|
|
1482
1532
|
chainSpecificData?: {
|
|
1483
1533
|
cardanoCoseKey?: string;
|
|
1484
|
-
} | SolanaMetadata;
|
|
1534
|
+
} | SolanaMetadata | CosmosMetadata;
|
|
1485
1535
|
}
|
|
1486
1536
|
|
|
1487
1537
|
/**
|
|
@@ -1611,6 +1661,7 @@ export declare interface ThresholdOptions {
|
|
|
1611
1661
|
* @public
|
|
1612
1662
|
*/
|
|
1613
1663
|
export declare interface Transaction extends ComponentRequest {
|
|
1664
|
+
transactionId?: string;
|
|
1614
1665
|
agent: Agent;
|
|
1615
1666
|
counterparty: Counterparty;
|
|
1616
1667
|
asset: TransactionAsset;
|
package/dist/cjs/package.json
CHANGED
package/dist/esm/notabene.d.ts
CHANGED
|
@@ -223,6 +223,19 @@ export declare enum CMType {
|
|
|
223
223
|
INFO = "info"
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
/**
|
|
227
|
+
* Status of a code verification
|
|
228
|
+
* @public
|
|
229
|
+
*/
|
|
230
|
+
export declare enum CodeVerificationStatus {
|
|
231
|
+
PENDING = "pending",
|
|
232
|
+
APPROVED = "approved",
|
|
233
|
+
FAILED = "failed",
|
|
234
|
+
EXPIRED = "expired",
|
|
235
|
+
MAX_ATTEMPTS_REACHED = "max_attempts_reached",
|
|
236
|
+
UNREACHABLE = "unreachable"
|
|
237
|
+
}
|
|
238
|
+
|
|
226
239
|
/**
|
|
227
240
|
* Represents a completed component message
|
|
228
241
|
* @typeParam T - The overall Value type being returned
|
|
@@ -312,6 +325,8 @@ export declare interface ConnectionData<T extends ComponentRequest> {
|
|
|
312
325
|
readonly authToken?: string;
|
|
313
326
|
readonly txOptions?: TransactionOptions;
|
|
314
327
|
readonly result?: TransactionResponse<T>;
|
|
328
|
+
readonly phoneNumber?: string;
|
|
329
|
+
readonly email?: string;
|
|
315
330
|
}
|
|
316
331
|
|
|
317
332
|
/**
|
|
@@ -403,6 +418,19 @@ export declare type ConnectionResult<T extends ComponentRequest> = {
|
|
|
403
418
|
|
|
404
419
|
export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
|
|
405
420
|
|
|
421
|
+
/**
|
|
422
|
+
* Metadata for Cosmos ownership proofs
|
|
423
|
+
* @remarks
|
|
424
|
+
* - Includes the public key
|
|
425
|
+
* @public
|
|
426
|
+
*/
|
|
427
|
+
export declare interface CosmosMetadata {
|
|
428
|
+
pub_key: {
|
|
429
|
+
type: string;
|
|
430
|
+
value: string;
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
406
434
|
/**
|
|
407
435
|
* The counterparty of a transaction.
|
|
408
436
|
* @public
|
|
@@ -452,6 +480,7 @@ export declare interface Counterparty {
|
|
|
452
480
|
*/
|
|
453
481
|
export declare type CounterpartyAssistConfig = boolean | {
|
|
454
482
|
counterpartyTypes: PersonType[];
|
|
483
|
+
identityVerification?: IdentityVerificationConfig;
|
|
455
484
|
};
|
|
456
485
|
|
|
457
486
|
/**
|
|
@@ -494,7 +523,7 @@ export declare function decodeFragmentToObject(fragment: string): Record<string,
|
|
|
494
523
|
* An object representing a deposit transaction
|
|
495
524
|
* @public
|
|
496
525
|
*/
|
|
497
|
-
export declare interface Deposit extends OriginatorFields,
|
|
526
|
+
export declare interface Deposit extends OriginatorFields, Transaction, Refreshable {
|
|
498
527
|
}
|
|
499
528
|
|
|
500
529
|
/**
|
|
@@ -524,14 +553,6 @@ export declare interface DepositRequestOptions {
|
|
|
524
553
|
showQrCode?: boolean;
|
|
525
554
|
}
|
|
526
555
|
|
|
527
|
-
/**
|
|
528
|
-
* Extended transaction interface for deposits
|
|
529
|
-
* @public
|
|
530
|
-
*/
|
|
531
|
-
declare interface DepositTransaction extends Transaction {
|
|
532
|
-
transactionId?: string;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
556
|
/**
|
|
536
557
|
* The destination of a transaction either a blockchain address, a CAIP-19 address, or a travel address.
|
|
537
558
|
* @public
|
|
@@ -737,6 +758,26 @@ export declare enum HMType {
|
|
|
737
758
|
*/
|
|
738
759
|
export declare type HostMessage<T, O> = UpdateValue<T, O>;
|
|
739
760
|
|
|
761
|
+
/**
|
|
762
|
+
* Configuration options for identity verification
|
|
763
|
+
* @public
|
|
764
|
+
*/
|
|
765
|
+
declare type IdentityVerificationConfig = {
|
|
766
|
+
/** The required verification method. If not specified, none will be used */
|
|
767
|
+
requiredMethod?: IdentityVerificationMethod;
|
|
768
|
+
/** OAuth provider(s) to use for authentication. Can be a single provider or array of providers */
|
|
769
|
+
oAuth?: OAuthProvider[] | OAuthProvider;
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Available methods for identity verification
|
|
774
|
+
* @public
|
|
775
|
+
*/
|
|
776
|
+
export declare enum IdentityVerificationMethod {
|
|
777
|
+
SMS = "sms",
|
|
778
|
+
EMAIL = "email"
|
|
779
|
+
}
|
|
780
|
+
|
|
740
781
|
/**
|
|
741
782
|
* Represents an info component message
|
|
742
783
|
* @param message - Info message
|
|
@@ -1232,6 +1273,14 @@ export declare interface NotabeneConfig {
|
|
|
1232
1273
|
locale?: string;
|
|
1233
1274
|
}
|
|
1234
1275
|
|
|
1276
|
+
/**
|
|
1277
|
+
* Supported OAuth providers for authentication
|
|
1278
|
+
* @public
|
|
1279
|
+
*/
|
|
1280
|
+
export declare enum OAuthProvider {
|
|
1281
|
+
COINBASE = "coinbase"
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1235
1284
|
/**
|
|
1236
1285
|
* Originating VASP
|
|
1237
1286
|
* Represents the VASP which initiates the VA transfer
|
|
@@ -1413,6 +1462,7 @@ export declare enum ProofTypes {
|
|
|
1413
1462
|
XRP_ED25519 = "xrp-ed25519",
|
|
1414
1463
|
XLM_ED25519 = "xlm-ed25519",
|
|
1415
1464
|
CIP8 = "cip-8",
|
|
1465
|
+
COSMOS = "cosmos-ecdsa",
|
|
1416
1466
|
MicroTransfer = "microtransfer",
|
|
1417
1467
|
Screenshot = "screenshot",
|
|
1418
1468
|
Connect = "connect",
|
|
@@ -1474,14 +1524,14 @@ export declare interface ScreenshotProof extends OwnershipProof {
|
|
|
1474
1524
|
* @public
|
|
1475
1525
|
*/
|
|
1476
1526
|
export declare interface SignatureProof extends OwnershipProof {
|
|
1477
|
-
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.BIP137_XPUB | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519;
|
|
1527
|
+
type: ProofTypes.EIP191 | ProofTypes.EIP712 | ProofTypes.EIP1271 | ProofTypes.BIP137 | ProofTypes.BIP322 | ProofTypes.BIP137_XPUB | ProofTypes.ED25519 | ProofTypes.TIP191 | ProofTypes.SIWX | ProofTypes.SOL_SIWX | ProofTypes.SIWE | ProofTypes.CIP8 | ProofTypes.XRP_ED25519 | ProofTypes.CONCORDIUM | ProofTypes.XLM_ED25519 | ProofTypes.COSMOS;
|
|
1478
1528
|
proof: string;
|
|
1479
1529
|
attestation: string;
|
|
1480
1530
|
wallet_provider: string;
|
|
1481
1531
|
xpub?: string;
|
|
1482
1532
|
chainSpecificData?: {
|
|
1483
1533
|
cardanoCoseKey?: string;
|
|
1484
|
-
} | SolanaMetadata;
|
|
1534
|
+
} | SolanaMetadata | CosmosMetadata;
|
|
1485
1535
|
}
|
|
1486
1536
|
|
|
1487
1537
|
/**
|
|
@@ -1611,6 +1661,7 @@ export declare interface ThresholdOptions {
|
|
|
1611
1661
|
* @public
|
|
1612
1662
|
*/
|
|
1613
1663
|
export declare interface Transaction extends ComponentRequest {
|
|
1664
|
+
transactionId?: string;
|
|
1614
1665
|
agent: Agent;
|
|
1615
1666
|
counterparty: Counterparty;
|
|
1616
1667
|
asset: TransactionAsset;
|