@notabene/javascript-sdk
Advanced tools
Comparing version
@@ -227,2 +227,15 @@ /** | ||
/** | ||
* Status of a code verification | ||
* @public | ||
*/ | ||
export declare enum CodeVerificationStatus { | ||
PENDING = "pending", | ||
APPROVED = "approved", | ||
FAILED = "failed", | ||
EXPIRED = "expired", | ||
MAX_ATTEMPTS_REACHED = "max_attempts_reached", | ||
UNREACHABLE = "unreachable" | ||
} | ||
/** | ||
* Represents a completed component message | ||
@@ -316,2 +329,4 @@ * @typeParam T - The overall Value type being returned | ||
readonly result?: TransactionResponse<T>; | ||
readonly phoneNumber?: string; | ||
readonly email?: string; | ||
} | ||
@@ -409,2 +424,15 @@ | ||
/** | ||
* Metadata for Cosmos ownership proofs | ||
* @remarks | ||
* - Includes the public key | ||
* @public | ||
*/ | ||
export declare interface CosmosMetadata { | ||
pub_key: { | ||
type: string; | ||
value: string; | ||
}; | ||
} | ||
/** | ||
* The counterparty of a transaction. | ||
@@ -458,2 +486,3 @@ * @public | ||
counterpartyTypes: PersonType[]; | ||
identityVerification?: IdentityVerificationConfig; | ||
}; | ||
@@ -501,3 +530,3 @@ | ||
*/ | ||
export declare interface Deposit extends OriginatorFields, DepositTransaction, Refreshable { | ||
export declare interface Deposit extends OriginatorFields, Transaction, Refreshable { | ||
} | ||
@@ -533,10 +562,2 @@ | ||
/** | ||
* Extended transaction interface for deposits | ||
* @public | ||
*/ | ||
declare interface DepositTransaction extends Transaction { | ||
transactionId?: string; | ||
} | ||
/** | ||
* The destination of a transaction either a blockchain address, a CAIP-19 address, or a travel address. | ||
@@ -747,2 +768,22 @@ * @public | ||
/** | ||
* Configuration options for identity verification | ||
* @public | ||
*/ | ||
declare type IdentityVerificationConfig = { | ||
/** The required verification method. If not specified, none will be used */ | ||
requiredMethod?: IdentityVerificationMethod; | ||
/** OAuth provider(s) to use for authentication. Can be a single provider or array of providers */ | ||
oAuth?: OAuthProvider[] | OAuthProvider; | ||
}; | ||
/** | ||
* Available methods for identity verification | ||
* @public | ||
*/ | ||
export declare enum IdentityVerificationMethod { | ||
SMS = "sms", | ||
EMAIL = "email" | ||
} | ||
/** | ||
* Represents an info component message | ||
@@ -1243,2 +1284,10 @@ * @param message - Info message | ||
/** | ||
* Supported OAuth providers for authentication | ||
* @public | ||
*/ | ||
export declare enum OAuthProvider { | ||
COINBASE = "coinbase" | ||
} | ||
/** | ||
* Originating VASP | ||
@@ -1424,2 +1473,3 @@ * Represents the VASP which initiates the VA transfer | ||
CIP8 = "cip-8", | ||
COSMOS = "cosmos-ecdsa", | ||
MicroTransfer = "microtransfer", | ||
@@ -1486,3 +1536,3 @@ Screenshot = "screenshot", | ||
export declare interface SignatureProof extends OwnershipProof { | ||
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; | ||
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; | ||
proof: string; | ||
@@ -1494,3 +1544,3 @@ attestation: string; | ||
cardanoCoseKey?: string; | ||
} | SolanaMetadata; | ||
} | SolanaMetadata | CosmosMetadata; | ||
} | ||
@@ -1625,2 +1675,3 @@ | ||
export declare interface Transaction extends ComponentRequest { | ||
transactionId?: string; | ||
agent: Agent; | ||
@@ -1627,0 +1678,0 @@ counterparty: Counterparty; |
@@ -13,3 +13,3 @@ { | ||
"packageManager": "yarn@4.5.1", | ||
"version": "2.11.0", | ||
"version": "2.12.0", | ||
"source": "src/notabene.ts", | ||
@@ -16,0 +16,0 @@ "main": "dist/cjs/notabene.cjs", |
@@ -227,2 +227,15 @@ /** | ||
/** | ||
* Status of a code verification | ||
* @public | ||
*/ | ||
export declare enum CodeVerificationStatus { | ||
PENDING = "pending", | ||
APPROVED = "approved", | ||
FAILED = "failed", | ||
EXPIRED = "expired", | ||
MAX_ATTEMPTS_REACHED = "max_attempts_reached", | ||
UNREACHABLE = "unreachable" | ||
} | ||
/** | ||
* Represents a completed component message | ||
@@ -316,2 +329,4 @@ * @typeParam T - The overall Value type being returned | ||
readonly result?: TransactionResponse<T>; | ||
readonly phoneNumber?: string; | ||
readonly email?: string; | ||
} | ||
@@ -409,2 +424,15 @@ | ||
/** | ||
* Metadata for Cosmos ownership proofs | ||
* @remarks | ||
* - Includes the public key | ||
* @public | ||
*/ | ||
export declare interface CosmosMetadata { | ||
pub_key: { | ||
type: string; | ||
value: string; | ||
}; | ||
} | ||
/** | ||
* The counterparty of a transaction. | ||
@@ -458,2 +486,3 @@ * @public | ||
counterpartyTypes: PersonType[]; | ||
identityVerification?: IdentityVerificationConfig; | ||
}; | ||
@@ -501,3 +530,3 @@ | ||
*/ | ||
export declare interface Deposit extends OriginatorFields, DepositTransaction, Refreshable { | ||
export declare interface Deposit extends OriginatorFields, Transaction, Refreshable { | ||
} | ||
@@ -533,10 +562,2 @@ | ||
/** | ||
* Extended transaction interface for deposits | ||
* @public | ||
*/ | ||
declare interface DepositTransaction extends Transaction { | ||
transactionId?: string; | ||
} | ||
/** | ||
* The destination of a transaction either a blockchain address, a CAIP-19 address, or a travel address. | ||
@@ -747,2 +768,22 @@ * @public | ||
/** | ||
* Configuration options for identity verification | ||
* @public | ||
*/ | ||
declare type IdentityVerificationConfig = { | ||
/** The required verification method. If not specified, none will be used */ | ||
requiredMethod?: IdentityVerificationMethod; | ||
/** OAuth provider(s) to use for authentication. Can be a single provider or array of providers */ | ||
oAuth?: OAuthProvider[] | OAuthProvider; | ||
}; | ||
/** | ||
* Available methods for identity verification | ||
* @public | ||
*/ | ||
export declare enum IdentityVerificationMethod { | ||
SMS = "sms", | ||
EMAIL = "email" | ||
} | ||
/** | ||
* Represents an info component message | ||
@@ -1243,2 +1284,10 @@ * @param message - Info message | ||
/** | ||
* Supported OAuth providers for authentication | ||
* @public | ||
*/ | ||
export declare enum OAuthProvider { | ||
COINBASE = "coinbase" | ||
} | ||
/** | ||
* Originating VASP | ||
@@ -1424,2 +1473,3 @@ * Represents the VASP which initiates the VA transfer | ||
CIP8 = "cip-8", | ||
COSMOS = "cosmos-ecdsa", | ||
MicroTransfer = "microtransfer", | ||
@@ -1486,3 +1536,3 @@ Screenshot = "screenshot", | ||
export declare interface SignatureProof extends OwnershipProof { | ||
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; | ||
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; | ||
proof: string; | ||
@@ -1494,3 +1544,3 @@ attestation: string; | ||
cardanoCoseKey?: string; | ||
} | SolanaMetadata; | ||
} | SolanaMetadata | CosmosMetadata; | ||
} | ||
@@ -1625,2 +1675,3 @@ | ||
export declare interface Transaction extends ComponentRequest { | ||
transactionId?: string; | ||
agent: Agent; | ||
@@ -1627,0 +1678,0 @@ counterparty: Counterparty; |
@@ -1,9 +0,9 @@ | ||
var v = Object.defineProperty; | ||
var g = (t, e, n) => e in t ? v(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; | ||
var a = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n); | ||
var A = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(A || {}), I = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(I || {}), y = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(y || {}), N = /* @__PURE__ */ ((t) => (t.ALLOWED = "allowed", t.PENDING = "pending", t))(N || {}), L = /* @__PURE__ */ ((t) => (t.ASSET = "asset", t.DESTINATION = "destination", t.COUNTERPARTY = "counterparty", t.AGENT = "agent", t))(L || {}), l = /* @__PURE__ */ ((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 || {}), b = /* @__PURE__ */ ((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))(b || {}), E = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(E || {}), C = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(C || {}), U = /* @__PURE__ */ ((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))(U || {}); | ||
class _ { | ||
var A = Object.defineProperty; | ||
var v = (e, t, n) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; | ||
var o = (e, t, n) => v(e, typeof t != "symbol" ? t + "" : t, n); | ||
var g = /* @__PURE__ */ ((e) => (e.PRIVATE = "WALLET", e.VASP = "VASP", e))(g || {}), I = /* @__PURE__ */ ((e) => (e.NATURAL = "natural", e.LEGAL = "legal", e.SELF = "self", e))(I || {}), N = /* @__PURE__ */ ((e) => (e.EMPTY = "empty", e.VERIFY = "verify", e.PENDING = "pending", e.VERIFIED = "verified", e.BANNED = "banned", e))(N || {}), L = /* @__PURE__ */ ((e) => (e.ALLOWED = "allowed", e.PENDING = "pending", e))(L || {}), b = /* @__PURE__ */ ((e) => (e.SMS = "sms", e.EMAIL = "email", e))(b || {}), y = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.APPROVED = "approved", e.FAILED = "failed", e.EXPIRED = "expired", e.MAX_ATTEMPTS_REACHED = "max_attempts_reached", e.UNREACHABLE = "unreachable", e))(y || {}), C = /* @__PURE__ */ ((e) => (e.COINBASE = "coinbase", e))(C || {}), U = /* @__PURE__ */ ((e) => (e.ASSET = "asset", e.DESTINATION = "destination", e.COUNTERPARTY = "counterparty", e.AGENT = "agent", e))(U || {}), l = /* @__PURE__ */ ((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 || {}), _ = /* @__PURE__ */ ((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))(_ || {}), p = /* @__PURE__ */ ((e) => (e.UPDATE = "update", e.REQUEST_RESPONSE = "requestResponse", e))(p || {}), D = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.FAILED = "rejected", e.FLAGGED = "flagged", e.VERIFIED = "verified", e))(D || {}), R = /* @__PURE__ */ ((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))(R || {}); | ||
class O { | ||
constructor() { | ||
a(this, "listeners", /* @__PURE__ */ new Map()); | ||
a(this, "port"); | ||
o(this, "listeners", /* @__PURE__ */ new Map()); | ||
o(this, "port"); | ||
this.handleMessage = this.handleMessage.bind(this); | ||
@@ -19,4 +19,4 @@ } | ||
*/ | ||
setPort(e) { | ||
this.port = e, this.port.onmessage = this.handleMessage, this.port.start(); | ||
setPort(t) { | ||
this.port = t, this.port.onmessage = this.handleMessage, this.port.start(); | ||
} | ||
@@ -33,4 +33,4 @@ /** | ||
*/ | ||
on(e, n) { | ||
return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(n), () => this.off(e, n); | ||
on(t, n) { | ||
return this.listeners.has(t) || this.listeners.set(t, /* @__PURE__ */ new Set()), this.listeners.get(t).add(n), () => this.off(t, n); | ||
} | ||
@@ -46,5 +46,5 @@ /** | ||
*/ | ||
off(e, n) { | ||
const s = this.listeners.get(e); | ||
s && (s.delete(n), s.size === 0 && this.listeners.delete(e)); | ||
off(t, n) { | ||
const r = this.listeners.get(t); | ||
r && (r.delete(n), r.size === 0 && this.listeners.delete(t)); | ||
} | ||
@@ -59,7 +59,7 @@ /** | ||
*/ | ||
handleMessage(e) { | ||
const n = e.data; | ||
handleMessage(t) { | ||
const n = t.data; | ||
if (typeof n == "object" && n !== null && "type" in n) { | ||
const s = n.type, r = this.listeners.get(s); | ||
r && r.forEach((i) => i(n)); | ||
const r = n.type, s = this.listeners.get(r); | ||
s && s.forEach((i) => i(n)); | ||
} | ||
@@ -71,4 +71,4 @@ } | ||
*/ | ||
send(e) { | ||
this.port && this.port.postMessage(e); | ||
send(t) { | ||
this.port && this.port.postMessage(t); | ||
} | ||
@@ -82,14 +82,14 @@ } | ||
*/ | ||
constructor(e, n, s) { | ||
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 = s, this.eventManager = new _(), this.on(l.INVALID, (r) => { | ||
r.type === l.INVALID && (this._errors = r.errors, this._value = r.value); | ||
}), this.on(l.RESIZE, (r) => { | ||
r.type === l.RESIZE && this.iframe && (this.iframe.style.height = `${r.height}px`); | ||
constructor(t, n, r) { | ||
o(this, "_url"); | ||
o(this, "_value"); | ||
o(this, "_options"); | ||
o(this, "_errors", []); | ||
o(this, "iframe"); | ||
o(this, "eventManager"); | ||
o(this, "modal"); | ||
this._url = t, this._value = n, this._options = r, this.eventManager = new O(), 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`); | ||
}); | ||
@@ -128,5 +128,5 @@ } | ||
*/ | ||
mount(e) { | ||
const n = document.querySelector(e); | ||
if (!n) throw new Error(`parentID ${e} not found`); | ||
mount(t) { | ||
const n = document.querySelector(t); | ||
if (!n) throw new Error(`parentID ${t} not found`); | ||
this.embed(n); | ||
@@ -138,8 +138,8 @@ } | ||
*/ | ||
embed(e, n = !1) { | ||
var s, r; | ||
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])); | ||
}), (r = (s = this.iframe) == null ? void 0 : s.contentWindow) == null || r.focus(); | ||
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 a, c; | ||
i.source === ((a = this.iframe) == null ? void 0 : a.contentWindow) && ((c = this.eventManager) == null || c.setPort(i.ports[0])); | ||
}), (s = (r = this.iframe) == null ? void 0 : r.contentWindow) == null || s.focus(); | ||
} | ||
@@ -153,4 +153,4 @@ removeEmbed() { | ||
*/ | ||
send(e) { | ||
this.eventManager.send(e); | ||
send(t) { | ||
this.eventManager.send(t); | ||
} | ||
@@ -162,4 +162,4 @@ /** | ||
*/ | ||
on(e, n) { | ||
return this.eventManager.on(e, n); | ||
on(t, n) { | ||
return this.eventManager.on(t, n); | ||
} | ||
@@ -171,4 +171,4 @@ /** | ||
*/ | ||
off(e, n) { | ||
this.eventManager.off(e, n); | ||
off(t, n) { | ||
this.eventManager.off(t, n); | ||
} | ||
@@ -179,4 +179,4 @@ /** | ||
*/ | ||
update(e, n) { | ||
this._value = e, n && (this._options = n), this.send({ type: E.UPDATE, value: e, options: this._options }); | ||
update(t, n) { | ||
this._value = t, n && (this._options = n), this.send({ type: p.UPDATE, value: t, options: this._options }); | ||
} | ||
@@ -188,13 +188,13 @@ /** | ||
completion() { | ||
return new Promise((e, n) => { | ||
let s, r, i; | ||
function o() { | ||
s && s(), r && r(), i && i(); | ||
return new Promise((t, n) => { | ||
let r, s, i; | ||
function a() { | ||
r && r(), s && s(), i && i(); | ||
} | ||
s = this.on(l.COMPLETE, (c) => { | ||
e(c.response), o(); | ||
}), r = this.on(l.CANCEL, () => { | ||
n(new Error("User cancelled")), o(); | ||
r = this.on(l.COMPLETE, (c) => { | ||
t(c.response), a(); | ||
}), s = this.on(l.CANCEL, () => { | ||
n(new Error("User cancelled")), a(); | ||
}), i = this.on("error", (c) => { | ||
n(new Error(c.message)), o(); | ||
n(new Error(c.message)), a(); | ||
}); | ||
@@ -208,3 +208,3 @@ }); | ||
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, () => { | ||
const t = this.on(l.CANCEL, () => { | ||
this.closeModal(); | ||
@@ -217,3 +217,3 @@ }), n = this.on(l.COMPLETE, () => { | ||
}), this.completion().finally(() => { | ||
e(), n(); | ||
t(), n(); | ||
}); | ||
@@ -226,4 +226,4 @@ } | ||
closeModal() { | ||
var e; | ||
this.modal && ((e = this.modal) == null || e.close(), this.modal.remove(), this.modal = void 0); | ||
var t; | ||
this.modal && ((t = this.modal) == null || t.close(), this.modal.remove(), this.modal = void 0); | ||
} | ||
@@ -237,3 +237,3 @@ /** | ||
async popup() { | ||
const e = window.open( | ||
const t = window.open( | ||
this.url, | ||
@@ -243,32 +243,32 @@ "_blank", | ||
); | ||
window.addEventListener("message", (r) => { | ||
window.addEventListener("message", (s) => { | ||
var i; | ||
r.source === e && (console.log("received message from popup", r.data), (i = this.eventManager) == null || i.setPort(r.ports[0])); | ||
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, () => { | ||
e == null || e.close(); | ||
}), s = this.on(l.COMPLETE, () => { | ||
e == null || e.close(); | ||
t == null || t.close(); | ||
}), r = this.on(l.COMPLETE, () => { | ||
t == null || t.close(); | ||
}); | ||
return this.completion().finally(() => { | ||
n(), s(); | ||
n(), r(); | ||
}); | ||
} | ||
} | ||
function R(t) { | ||
return Object.entries(t).map(([e, n]) => { | ||
function M(e) { | ||
return Object.entries(e).map(([t, n]) => { | ||
if (n == null) return; | ||
const s = encodeURIComponent(e), r = encodeURIComponent( | ||
const r = encodeURIComponent(t), s = encodeURIComponent( | ||
typeof n == "object" ? JSON.stringify(n) : String(n) | ||
// Use String() to handle all primitive types | ||
); | ||
return `${s}=${r}`; | ||
}).filter((e) => e !== void 0).join("&"); | ||
return `${r}=${s}`; | ||
}).filter((t) => t !== void 0).join("&"); | ||
} | ||
function O(t) { | ||
const e = t.slice(1); | ||
return e ? e.split("&").filter(Boolean).reduce( | ||
(s, r) => { | ||
const [i, o] = r.split("="); | ||
return i && (s[decodeURIComponent(i)] = o ? decodeURIComponent(o) : ""), s; | ||
function k(e) { | ||
const t = e.slice(1); | ||
return t ? t.split("&").filter(Boolean).reduce( | ||
(r, s) => { | ||
const [i, a] = s.split("="); | ||
return i && (r[decodeURIComponent(i)] = a ? decodeURIComponent(a) : ""), r; | ||
}, | ||
@@ -278,25 +278,25 @@ {} | ||
} | ||
async function p(t, e) { | ||
const n = JSON.stringify(t), s = new TextEncoder(), r = e ? m(e) : crypto.getRandomValues(new Uint8Array(32)), i = await crypto.subtle.importKey( | ||
async function E(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", | ||
r, | ||
s, | ||
{ name: "AES-GCM" }, | ||
!1, | ||
["encrypt"] | ||
), o = crypto.getRandomValues(new Uint8Array(12)), c = await crypto.subtle.encrypt( | ||
{ name: "AES-GCM", iv: o }, | ||
), a = crypto.getRandomValues(new Uint8Array(12)), c = await crypto.subtle.encrypt( | ||
{ name: "AES-GCM", iv: a }, | ||
i, | ||
s.encode(n) | ||
r.encode(n) | ||
); | ||
return { | ||
ciphertext: `${u(o)}-${u(c)}`, | ||
key: u(r) | ||
ciphertext: `${u(a)}-${u(c)}`, | ||
key: u(s) | ||
}; | ||
} | ||
async function f({ ciphertext: t, key: e }) { | ||
const [n, s] = t.split("-"), r = new Uint8Array( | ||
atob(e).split("").map((w) => w.charCodeAt(0)) | ||
), i = m(n), o = m(s), c = await crypto.subtle.importKey( | ||
async function f({ ciphertext: e, key: t }) { | ||
const [n, r] = e.split("-"), s = new Uint8Array( | ||
atob(t).split("").map((w) => w.charCodeAt(0)) | ||
), i = m(n), a = m(r), c = await crypto.subtle.importKey( | ||
"raw", | ||
r, | ||
s, | ||
{ name: "AES-GCM" }, | ||
@@ -308,29 +308,29 @@ !1, | ||
c, | ||
o | ||
a | ||
); | ||
return JSON.parse(h.decode(d)); | ||
} | ||
function u(t) { | ||
const e = new Uint8Array(t); | ||
function u(e) { | ||
const t = new Uint8Array(e); | ||
let n = ""; | ||
for (let s = 0; s < e.length; s++) | ||
n += String.fromCharCode(e[s]); | ||
for (let r = 0; r < t.length; r++) | ||
n += String.fromCharCode(t[r]); | ||
return btoa(n); | ||
} | ||
function m(t) { | ||
const e = atob(t), n = new Uint8Array(e.length); | ||
for (let s = 0; s < e.length; s++) | ||
n[s] = e.charCodeAt(s); | ||
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 S(t) { | ||
const e = await fetch(t.url, { | ||
async function P(e) { | ||
const t = await fetch(e.url, { | ||
method: "GET" | ||
}); | ||
if (!e.ok) | ||
throw new Error(`Failed to get connection: ${await e.text()}`); | ||
const n = await e.json(); | ||
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 s = { | ||
const r = { | ||
id: n.id, | ||
@@ -341,19 +341,19 @@ metadata: n.metadata, | ||
if (n.status === "closed") | ||
return s; | ||
const r = n.sealed[n.sealed.length - 1], i = await f({ | ||
ciphertext: r, | ||
key: t.key | ||
return r; | ||
const s = n.sealed[n.sealed.length - 1], i = await f({ | ||
ciphertext: s, | ||
key: e.key | ||
}); | ||
return n.status === "completed" ? { | ||
...s, | ||
...r, | ||
result: i.result | ||
} : { | ||
...s, | ||
...r, | ||
tx: i.tx | ||
}; | ||
} | ||
class M { | ||
constructor(e) { | ||
a(this, "endpoint"); | ||
this.endpoint = e; | ||
class T { | ||
constructor(t) { | ||
o(this, "endpoint"); | ||
this.endpoint = t; | ||
} | ||
@@ -367,6 +367,6 @@ /** | ||
*/ | ||
async create(e, n) { | ||
const s = await p(e), r = { | ||
async create(t, n) { | ||
const r = await E(t), s = { | ||
metadata: n, | ||
sealed: s.ciphertext | ||
sealed: r.ciphertext | ||
}, i = await fetch(this.endpoint, { | ||
@@ -377,14 +377,14 @@ method: "POST", | ||
}, | ||
body: JSON.stringify(r) | ||
body: JSON.stringify(s) | ||
}); | ||
if (!i.ok) | ||
throw new Error(`Failed to create connection: ${await i.text()}`); | ||
const o = await i.json(); | ||
const a = await i.json(); | ||
return { | ||
id: o.id, | ||
version: o.version, | ||
status: o.status, | ||
id: a.id, | ||
version: a.version, | ||
status: a.status, | ||
metadata: n, | ||
data: e, | ||
key: s.key | ||
data: t, | ||
key: r.key | ||
}; | ||
@@ -402,8 +402,8 @@ } | ||
*/ | ||
async update(e, n, s, r, i) { | ||
const o = await p(n, i), c = { | ||
sealed: o.ciphertext, | ||
version: s, | ||
status: r | ||
}, h = await fetch(`${this.endpoint}/${e}`, { | ||
async update(t, n, r, s, i) { | ||
const a = await E(n, i), c = { | ||
sealed: a.ciphertext, | ||
version: r, | ||
status: s | ||
}, h = await fetch(`${this.endpoint}/${t}`, { | ||
method: "PATCH", | ||
@@ -424,3 +424,3 @@ headers: { | ||
data: n, | ||
key: o.key | ||
key: a.key | ||
}; | ||
@@ -435,9 +435,9 @@ } | ||
*/ | ||
async get(e, n) { | ||
const s = await fetch(`${this.endpoint}/${e}`, { | ||
async get(t, n) { | ||
const r = await fetch(`${this.endpoint}/${t}`, { | ||
method: "GET" | ||
}); | ||
if (!s.ok) | ||
throw new Error(`Failed to get connection: ${await s.text()}`); | ||
const r = await s.json(), i = r.sealed[r.sealed.length - 1], o = await f({ | ||
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], a = await f({ | ||
ciphertext: i, | ||
@@ -447,7 +447,7 @@ key: n | ||
return { | ||
id: r.id, | ||
status: r.status, | ||
version: r.version, | ||
metadata: r.metadata, | ||
data: o, | ||
id: s.id, | ||
status: s.status, | ||
version: s.version, | ||
metadata: s.metadata, | ||
data: a, | ||
key: n | ||
@@ -461,4 +461,4 @@ }; | ||
*/ | ||
async close(e) { | ||
const n = await fetch(`${this.endpoint}/${e}`, { | ||
async close(t) { | ||
const n = await fetch(`${this.endpoint}/${t}`, { | ||
method: "DELETE" | ||
@@ -470,3 +470,3 @@ }); | ||
} | ||
class k { | ||
class B { | ||
/** | ||
@@ -477,9 +477,9 @@ * Creates a new instance of the Notabene SDK | ||
*/ | ||
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; | ||
constructor(t) { | ||
o(this, "nodeUrl"); | ||
o(this, "authToken"); | ||
o(this, "uxUrl"); | ||
o(this, "theme"); | ||
o(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; | ||
} | ||
@@ -496,11 +496,11 @@ /** | ||
*/ | ||
componentUrl(e, n, s, r) { | ||
componentUrl(t, n, r, s) { | ||
const i = new URL(this.uxUrl); | ||
i.pathname = e; | ||
const o = R({ | ||
i.pathname = t; | ||
const a = M({ | ||
authToken: this.authToken, | ||
value: n, | ||
configuration: s | ||
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), r && (r.callback && i.searchParams.set("callback_url", r.callback), r.redirectUri && i.searchParams.set("redirect_uri", r.redirectUri)), i.toString(); | ||
return i.hash = a, 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(); | ||
} | ||
@@ -517,7 +517,7 @@ /** | ||
*/ | ||
createComponent(e, n, s, r) { | ||
createComponent(t, n, r, s) { | ||
return new x( | ||
this.componentUrl(e, n, s, r), | ||
this.componentUrl(t, n, r, s), | ||
n, | ||
s | ||
r | ||
); | ||
@@ -533,8 +533,8 @@ } | ||
*/ | ||
createWithdrawalAssist(e, n, s) { | ||
createWithdrawalAssist(t, n, r) { | ||
return this.createComponent( | ||
"withdrawal-assist", | ||
e, | ||
t, | ||
n, | ||
s | ||
r | ||
); | ||
@@ -551,8 +551,8 @@ } | ||
*/ | ||
createConnectWallet(e, n, s) { | ||
createConnectWallet(t, n, r) { | ||
return this.createComponent( | ||
"connect", | ||
e, | ||
t, | ||
n, | ||
s | ||
r | ||
); | ||
@@ -569,8 +569,8 @@ } | ||
*/ | ||
createDepositRequest(e, n, s) { | ||
createDepositRequest(t, n, r) { | ||
return this.createComponent( | ||
"deposit-request", | ||
e, | ||
t, | ||
n, | ||
s | ||
r | ||
); | ||
@@ -587,8 +587,8 @@ } | ||
*/ | ||
createDepositAssist(e, n, s) { | ||
createDepositAssist(t, n, r) { | ||
return this.createComponent( | ||
"deposit-assist", | ||
e, | ||
t, | ||
n, | ||
s | ||
r | ||
); | ||
@@ -598,17 +598,20 @@ } | ||
export { | ||
A as AgentType, | ||
g as AgentType, | ||
l as CMType, | ||
M as ConnectionManager, | ||
y as CodeVerificationStatus, | ||
T as ConnectionManager, | ||
x as EmbeddedComponent, | ||
b as ErrorIdentifierCode, | ||
E as HMType, | ||
_ as ErrorIdentifierCode, | ||
p as HMType, | ||
b as IdentityVerificationMethod, | ||
C as OAuthProvider, | ||
I as PersonType, | ||
C as ProofStatus, | ||
U as ProofTypes, | ||
y as Status, | ||
N as VASPSearchControl, | ||
L as ValidationSections, | ||
O as decodeFragmentToObject, | ||
k as default, | ||
S as getRefreshResult | ||
D as ProofStatus, | ||
R as ProofTypes, | ||
N as Status, | ||
L as VASPSearchControl, | ||
U as ValidationSections, | ||
k as decodeFragmentToObject, | ||
B as default, | ||
P as getRefreshResult | ||
}; |
@@ -13,3 +13,3 @@ { | ||
"packageManager": "yarn@4.5.1", | ||
"version": "2.11.0", | ||
"version": "2.12.0", | ||
"source": "src/notabene.ts", | ||
@@ -16,0 +16,0 @@ "main": "dist/cjs/notabene.cjs", |
@@ -227,2 +227,15 @@ /** | ||
/** | ||
* Status of a code verification | ||
* @public | ||
*/ | ||
export declare enum CodeVerificationStatus { | ||
PENDING = "pending", | ||
APPROVED = "approved", | ||
FAILED = "failed", | ||
EXPIRED = "expired", | ||
MAX_ATTEMPTS_REACHED = "max_attempts_reached", | ||
UNREACHABLE = "unreachable" | ||
} | ||
/** | ||
* Represents a completed component message | ||
@@ -316,2 +329,4 @@ * @typeParam T - The overall Value type being returned | ||
readonly result?: TransactionResponse<T>; | ||
readonly phoneNumber?: string; | ||
readonly email?: string; | ||
} | ||
@@ -409,2 +424,15 @@ | ||
/** | ||
* Metadata for Cosmos ownership proofs | ||
* @remarks | ||
* - Includes the public key | ||
* @public | ||
*/ | ||
export declare interface CosmosMetadata { | ||
pub_key: { | ||
type: string; | ||
value: string; | ||
}; | ||
} | ||
/** | ||
* The counterparty of a transaction. | ||
@@ -458,2 +486,3 @@ * @public | ||
counterpartyTypes: PersonType[]; | ||
identityVerification?: IdentityVerificationConfig; | ||
}; | ||
@@ -501,3 +530,3 @@ | ||
*/ | ||
export declare interface Deposit extends OriginatorFields, DepositTransaction, Refreshable { | ||
export declare interface Deposit extends OriginatorFields, Transaction, Refreshable { | ||
} | ||
@@ -533,10 +562,2 @@ | ||
/** | ||
* Extended transaction interface for deposits | ||
* @public | ||
*/ | ||
declare interface DepositTransaction extends Transaction { | ||
transactionId?: string; | ||
} | ||
/** | ||
* The destination of a transaction either a blockchain address, a CAIP-19 address, or a travel address. | ||
@@ -747,2 +768,22 @@ * @public | ||
/** | ||
* Configuration options for identity verification | ||
* @public | ||
*/ | ||
declare type IdentityVerificationConfig = { | ||
/** The required verification method. If not specified, none will be used */ | ||
requiredMethod?: IdentityVerificationMethod; | ||
/** OAuth provider(s) to use for authentication. Can be a single provider or array of providers */ | ||
oAuth?: OAuthProvider[] | OAuthProvider; | ||
}; | ||
/** | ||
* Available methods for identity verification | ||
* @public | ||
*/ | ||
export declare enum IdentityVerificationMethod { | ||
SMS = "sms", | ||
EMAIL = "email" | ||
} | ||
/** | ||
* Represents an info component message | ||
@@ -1243,2 +1284,10 @@ * @param message - Info message | ||
/** | ||
* Supported OAuth providers for authentication | ||
* @public | ||
*/ | ||
export declare enum OAuthProvider { | ||
COINBASE = "coinbase" | ||
} | ||
/** | ||
* Originating VASP | ||
@@ -1424,2 +1473,3 @@ * Represents the VASP which initiates the VA transfer | ||
CIP8 = "cip-8", | ||
COSMOS = "cosmos-ecdsa", | ||
MicroTransfer = "microtransfer", | ||
@@ -1486,3 +1536,3 @@ Screenshot = "screenshot", | ||
export declare interface SignatureProof extends OwnershipProof { | ||
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; | ||
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; | ||
proof: string; | ||
@@ -1494,3 +1544,3 @@ attestation: string; | ||
cardanoCoseKey?: string; | ||
} | SolanaMetadata; | ||
} | SolanaMetadata | CosmosMetadata; | ||
} | ||
@@ -1625,2 +1675,3 @@ | ||
export declare interface Transaction extends ComponentRequest { | ||
transactionId?: string; | ||
agent: Agent; | ||
@@ -1627,0 +1678,0 @@ counterparty: Counterparty; |
@@ -1,9 +0,9 @@ | ||
var v = Object.defineProperty; | ||
var g = (t, e, n) => e in t ? v(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; | ||
var a = (t, e, n) => g(t, typeof e != "symbol" ? e + "" : e, n); | ||
var A = /* @__PURE__ */ ((t) => (t.PRIVATE = "WALLET", t.VASP = "VASP", t))(A || {}), I = /* @__PURE__ */ ((t) => (t.NATURAL = "natural", t.LEGAL = "legal", t.SELF = "self", t))(I || {}), y = /* @__PURE__ */ ((t) => (t.EMPTY = "empty", t.VERIFY = "verify", t.PENDING = "pending", t.VERIFIED = "verified", t.BANNED = "banned", t))(y || {}), N = /* @__PURE__ */ ((t) => (t.ALLOWED = "allowed", t.PENDING = "pending", t))(N || {}), L = /* @__PURE__ */ ((t) => (t.ASSET = "asset", t.DESTINATION = "destination", t.COUNTERPARTY = "counterparty", t.AGENT = "agent", t))(L || {}), l = /* @__PURE__ */ ((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 || {}), b = /* @__PURE__ */ ((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))(b || {}), E = /* @__PURE__ */ ((t) => (t.UPDATE = "update", t.REQUEST_RESPONSE = "requestResponse", t))(E || {}), C = /* @__PURE__ */ ((t) => (t.PENDING = "pending", t.FAILED = "rejected", t.FLAGGED = "flagged", t.VERIFIED = "verified", t))(C || {}), U = /* @__PURE__ */ ((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))(U || {}); | ||
class _ { | ||
var A = Object.defineProperty; | ||
var v = (e, t, n) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; | ||
var o = (e, t, n) => v(e, typeof t != "symbol" ? t + "" : t, n); | ||
var g = /* @__PURE__ */ ((e) => (e.PRIVATE = "WALLET", e.VASP = "VASP", e))(g || {}), I = /* @__PURE__ */ ((e) => (e.NATURAL = "natural", e.LEGAL = "legal", e.SELF = "self", e))(I || {}), N = /* @__PURE__ */ ((e) => (e.EMPTY = "empty", e.VERIFY = "verify", e.PENDING = "pending", e.VERIFIED = "verified", e.BANNED = "banned", e))(N || {}), L = /* @__PURE__ */ ((e) => (e.ALLOWED = "allowed", e.PENDING = "pending", e))(L || {}), b = /* @__PURE__ */ ((e) => (e.SMS = "sms", e.EMAIL = "email", e))(b || {}), y = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.APPROVED = "approved", e.FAILED = "failed", e.EXPIRED = "expired", e.MAX_ATTEMPTS_REACHED = "max_attempts_reached", e.UNREACHABLE = "unreachable", e))(y || {}), C = /* @__PURE__ */ ((e) => (e.COINBASE = "coinbase", e))(C || {}), U = /* @__PURE__ */ ((e) => (e.ASSET = "asset", e.DESTINATION = "destination", e.COUNTERPARTY = "counterparty", e.AGENT = "agent", e))(U || {}), l = /* @__PURE__ */ ((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 || {}), _ = /* @__PURE__ */ ((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))(_ || {}), p = /* @__PURE__ */ ((e) => (e.UPDATE = "update", e.REQUEST_RESPONSE = "requestResponse", e))(p || {}), D = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.FAILED = "rejected", e.FLAGGED = "flagged", e.VERIFIED = "verified", e))(D || {}), R = /* @__PURE__ */ ((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))(R || {}); | ||
class O { | ||
constructor() { | ||
a(this, "listeners", /* @__PURE__ */ new Map()); | ||
a(this, "port"); | ||
o(this, "listeners", /* @__PURE__ */ new Map()); | ||
o(this, "port"); | ||
this.handleMessage = this.handleMessage.bind(this); | ||
@@ -19,4 +19,4 @@ } | ||
*/ | ||
setPort(e) { | ||
this.port = e, this.port.onmessage = this.handleMessage, this.port.start(); | ||
setPort(t) { | ||
this.port = t, this.port.onmessage = this.handleMessage, this.port.start(); | ||
} | ||
@@ -33,4 +33,4 @@ /** | ||
*/ | ||
on(e, n) { | ||
return this.listeners.has(e) || this.listeners.set(e, /* @__PURE__ */ new Set()), this.listeners.get(e).add(n), () => this.off(e, n); | ||
on(t, n) { | ||
return this.listeners.has(t) || this.listeners.set(t, /* @__PURE__ */ new Set()), this.listeners.get(t).add(n), () => this.off(t, n); | ||
} | ||
@@ -46,5 +46,5 @@ /** | ||
*/ | ||
off(e, n) { | ||
const s = this.listeners.get(e); | ||
s && (s.delete(n), s.size === 0 && this.listeners.delete(e)); | ||
off(t, n) { | ||
const r = this.listeners.get(t); | ||
r && (r.delete(n), r.size === 0 && this.listeners.delete(t)); | ||
} | ||
@@ -59,7 +59,7 @@ /** | ||
*/ | ||
handleMessage(e) { | ||
const n = e.data; | ||
handleMessage(t) { | ||
const n = t.data; | ||
if (typeof n == "object" && n !== null && "type" in n) { | ||
const s = n.type, r = this.listeners.get(s); | ||
r && r.forEach((i) => i(n)); | ||
const r = n.type, s = this.listeners.get(r); | ||
s && s.forEach((i) => i(n)); | ||
} | ||
@@ -71,4 +71,4 @@ } | ||
*/ | ||
send(e) { | ||
this.port && this.port.postMessage(e); | ||
send(t) { | ||
this.port && this.port.postMessage(t); | ||
} | ||
@@ -82,14 +82,14 @@ } | ||
*/ | ||
constructor(e, n, s) { | ||
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 = s, this.eventManager = new _(), this.on(l.INVALID, (r) => { | ||
r.type === l.INVALID && (this._errors = r.errors, this._value = r.value); | ||
}), this.on(l.RESIZE, (r) => { | ||
r.type === l.RESIZE && this.iframe && (this.iframe.style.height = `${r.height}px`); | ||
constructor(t, n, r) { | ||
o(this, "_url"); | ||
o(this, "_value"); | ||
o(this, "_options"); | ||
o(this, "_errors", []); | ||
o(this, "iframe"); | ||
o(this, "eventManager"); | ||
o(this, "modal"); | ||
this._url = t, this._value = n, this._options = r, this.eventManager = new O(), 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`); | ||
}); | ||
@@ -128,5 +128,5 @@ } | ||
*/ | ||
mount(e) { | ||
const n = document.querySelector(e); | ||
if (!n) throw new Error(`parentID ${e} not found`); | ||
mount(t) { | ||
const n = document.querySelector(t); | ||
if (!n) throw new Error(`parentID ${t} not found`); | ||
this.embed(n); | ||
@@ -138,8 +138,8 @@ } | ||
*/ | ||
embed(e, n = !1) { | ||
var s, r; | ||
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])); | ||
}), (r = (s = this.iframe) == null ? void 0 : s.contentWindow) == null || r.focus(); | ||
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 a, c; | ||
i.source === ((a = this.iframe) == null ? void 0 : a.contentWindow) && ((c = this.eventManager) == null || c.setPort(i.ports[0])); | ||
}), (s = (r = this.iframe) == null ? void 0 : r.contentWindow) == null || s.focus(); | ||
} | ||
@@ -153,4 +153,4 @@ removeEmbed() { | ||
*/ | ||
send(e) { | ||
this.eventManager.send(e); | ||
send(t) { | ||
this.eventManager.send(t); | ||
} | ||
@@ -162,4 +162,4 @@ /** | ||
*/ | ||
on(e, n) { | ||
return this.eventManager.on(e, n); | ||
on(t, n) { | ||
return this.eventManager.on(t, n); | ||
} | ||
@@ -171,4 +171,4 @@ /** | ||
*/ | ||
off(e, n) { | ||
this.eventManager.off(e, n); | ||
off(t, n) { | ||
this.eventManager.off(t, n); | ||
} | ||
@@ -179,4 +179,4 @@ /** | ||
*/ | ||
update(e, n) { | ||
this._value = e, n && (this._options = n), this.send({ type: E.UPDATE, value: e, options: this._options }); | ||
update(t, n) { | ||
this._value = t, n && (this._options = n), this.send({ type: p.UPDATE, value: t, options: this._options }); | ||
} | ||
@@ -188,13 +188,13 @@ /** | ||
completion() { | ||
return new Promise((e, n) => { | ||
let s, r, i; | ||
function o() { | ||
s && s(), r && r(), i && i(); | ||
return new Promise((t, n) => { | ||
let r, s, i; | ||
function a() { | ||
r && r(), s && s(), i && i(); | ||
} | ||
s = this.on(l.COMPLETE, (c) => { | ||
e(c.response), o(); | ||
}), r = this.on(l.CANCEL, () => { | ||
n(new Error("User cancelled")), o(); | ||
r = this.on(l.COMPLETE, (c) => { | ||
t(c.response), a(); | ||
}), s = this.on(l.CANCEL, () => { | ||
n(new Error("User cancelled")), a(); | ||
}), i = this.on("error", (c) => { | ||
n(new Error(c.message)), o(); | ||
n(new Error(c.message)), a(); | ||
}); | ||
@@ -208,3 +208,3 @@ }); | ||
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, () => { | ||
const t = this.on(l.CANCEL, () => { | ||
this.closeModal(); | ||
@@ -217,3 +217,3 @@ }), n = this.on(l.COMPLETE, () => { | ||
}), this.completion().finally(() => { | ||
e(), n(); | ||
t(), n(); | ||
}); | ||
@@ -226,4 +226,4 @@ } | ||
closeModal() { | ||
var e; | ||
this.modal && ((e = this.modal) == null || e.close(), this.modal.remove(), this.modal = void 0); | ||
var t; | ||
this.modal && ((t = this.modal) == null || t.close(), this.modal.remove(), this.modal = void 0); | ||
} | ||
@@ -237,3 +237,3 @@ /** | ||
async popup() { | ||
const e = window.open( | ||
const t = window.open( | ||
this.url, | ||
@@ -243,32 +243,32 @@ "_blank", | ||
); | ||
window.addEventListener("message", (r) => { | ||
window.addEventListener("message", (s) => { | ||
var i; | ||
r.source === e && (console.log("received message from popup", r.data), (i = this.eventManager) == null || i.setPort(r.ports[0])); | ||
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, () => { | ||
e == null || e.close(); | ||
}), s = this.on(l.COMPLETE, () => { | ||
e == null || e.close(); | ||
t == null || t.close(); | ||
}), r = this.on(l.COMPLETE, () => { | ||
t == null || t.close(); | ||
}); | ||
return this.completion().finally(() => { | ||
n(), s(); | ||
n(), r(); | ||
}); | ||
} | ||
} | ||
function R(t) { | ||
return Object.entries(t).map(([e, n]) => { | ||
function M(e) { | ||
return Object.entries(e).map(([t, n]) => { | ||
if (n == null) return; | ||
const s = encodeURIComponent(e), r = encodeURIComponent( | ||
const r = encodeURIComponent(t), s = encodeURIComponent( | ||
typeof n == "object" ? JSON.stringify(n) : String(n) | ||
// Use String() to handle all primitive types | ||
); | ||
return `${s}=${r}`; | ||
}).filter((e) => e !== void 0).join("&"); | ||
return `${r}=${s}`; | ||
}).filter((t) => t !== void 0).join("&"); | ||
} | ||
function O(t) { | ||
const e = t.slice(1); | ||
return e ? e.split("&").filter(Boolean).reduce( | ||
(s, r) => { | ||
const [i, o] = r.split("="); | ||
return i && (s[decodeURIComponent(i)] = o ? decodeURIComponent(o) : ""), s; | ||
function k(e) { | ||
const t = e.slice(1); | ||
return t ? t.split("&").filter(Boolean).reduce( | ||
(r, s) => { | ||
const [i, a] = s.split("="); | ||
return i && (r[decodeURIComponent(i)] = a ? decodeURIComponent(a) : ""), r; | ||
}, | ||
@@ -278,25 +278,25 @@ {} | ||
} | ||
async function p(t, e) { | ||
const n = JSON.stringify(t), s = new TextEncoder(), r = e ? m(e) : crypto.getRandomValues(new Uint8Array(32)), i = await crypto.subtle.importKey( | ||
async function E(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", | ||
r, | ||
s, | ||
{ name: "AES-GCM" }, | ||
!1, | ||
["encrypt"] | ||
), o = crypto.getRandomValues(new Uint8Array(12)), c = await crypto.subtle.encrypt( | ||
{ name: "AES-GCM", iv: o }, | ||
), a = crypto.getRandomValues(new Uint8Array(12)), c = await crypto.subtle.encrypt( | ||
{ name: "AES-GCM", iv: a }, | ||
i, | ||
s.encode(n) | ||
r.encode(n) | ||
); | ||
return { | ||
ciphertext: `${u(o)}-${u(c)}`, | ||
key: u(r) | ||
ciphertext: `${u(a)}-${u(c)}`, | ||
key: u(s) | ||
}; | ||
} | ||
async function f({ ciphertext: t, key: e }) { | ||
const [n, s] = t.split("-"), r = new Uint8Array( | ||
atob(e).split("").map((w) => w.charCodeAt(0)) | ||
), i = m(n), o = m(s), c = await crypto.subtle.importKey( | ||
async function f({ ciphertext: e, key: t }) { | ||
const [n, r] = e.split("-"), s = new Uint8Array( | ||
atob(t).split("").map((w) => w.charCodeAt(0)) | ||
), i = m(n), a = m(r), c = await crypto.subtle.importKey( | ||
"raw", | ||
r, | ||
s, | ||
{ name: "AES-GCM" }, | ||
@@ -308,29 +308,29 @@ !1, | ||
c, | ||
o | ||
a | ||
); | ||
return JSON.parse(h.decode(d)); | ||
} | ||
function u(t) { | ||
const e = new Uint8Array(t); | ||
function u(e) { | ||
const t = new Uint8Array(e); | ||
let n = ""; | ||
for (let s = 0; s < e.length; s++) | ||
n += String.fromCharCode(e[s]); | ||
for (let r = 0; r < t.length; r++) | ||
n += String.fromCharCode(t[r]); | ||
return btoa(n); | ||
} | ||
function m(t) { | ||
const e = atob(t), n = new Uint8Array(e.length); | ||
for (let s = 0; s < e.length; s++) | ||
n[s] = e.charCodeAt(s); | ||
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 S(t) { | ||
const e = await fetch(t.url, { | ||
async function P(e) { | ||
const t = await fetch(e.url, { | ||
method: "GET" | ||
}); | ||
if (!e.ok) | ||
throw new Error(`Failed to get connection: ${await e.text()}`); | ||
const n = await e.json(); | ||
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 s = { | ||
const r = { | ||
id: n.id, | ||
@@ -341,19 +341,19 @@ metadata: n.metadata, | ||
if (n.status === "closed") | ||
return s; | ||
const r = n.sealed[n.sealed.length - 1], i = await f({ | ||
ciphertext: r, | ||
key: t.key | ||
return r; | ||
const s = n.sealed[n.sealed.length - 1], i = await f({ | ||
ciphertext: s, | ||
key: e.key | ||
}); | ||
return n.status === "completed" ? { | ||
...s, | ||
...r, | ||
result: i.result | ||
} : { | ||
...s, | ||
...r, | ||
tx: i.tx | ||
}; | ||
} | ||
class M { | ||
constructor(e) { | ||
a(this, "endpoint"); | ||
this.endpoint = e; | ||
class T { | ||
constructor(t) { | ||
o(this, "endpoint"); | ||
this.endpoint = t; | ||
} | ||
@@ -367,6 +367,6 @@ /** | ||
*/ | ||
async create(e, n) { | ||
const s = await p(e), r = { | ||
async create(t, n) { | ||
const r = await E(t), s = { | ||
metadata: n, | ||
sealed: s.ciphertext | ||
sealed: r.ciphertext | ||
}, i = await fetch(this.endpoint, { | ||
@@ -377,14 +377,14 @@ method: "POST", | ||
}, | ||
body: JSON.stringify(r) | ||
body: JSON.stringify(s) | ||
}); | ||
if (!i.ok) | ||
throw new Error(`Failed to create connection: ${await i.text()}`); | ||
const o = await i.json(); | ||
const a = await i.json(); | ||
return { | ||
id: o.id, | ||
version: o.version, | ||
status: o.status, | ||
id: a.id, | ||
version: a.version, | ||
status: a.status, | ||
metadata: n, | ||
data: e, | ||
key: s.key | ||
data: t, | ||
key: r.key | ||
}; | ||
@@ -402,8 +402,8 @@ } | ||
*/ | ||
async update(e, n, s, r, i) { | ||
const o = await p(n, i), c = { | ||
sealed: o.ciphertext, | ||
version: s, | ||
status: r | ||
}, h = await fetch(`${this.endpoint}/${e}`, { | ||
async update(t, n, r, s, i) { | ||
const a = await E(n, i), c = { | ||
sealed: a.ciphertext, | ||
version: r, | ||
status: s | ||
}, h = await fetch(`${this.endpoint}/${t}`, { | ||
method: "PATCH", | ||
@@ -424,3 +424,3 @@ headers: { | ||
data: n, | ||
key: o.key | ||
key: a.key | ||
}; | ||
@@ -435,9 +435,9 @@ } | ||
*/ | ||
async get(e, n) { | ||
const s = await fetch(`${this.endpoint}/${e}`, { | ||
async get(t, n) { | ||
const r = await fetch(`${this.endpoint}/${t}`, { | ||
method: "GET" | ||
}); | ||
if (!s.ok) | ||
throw new Error(`Failed to get connection: ${await s.text()}`); | ||
const r = await s.json(), i = r.sealed[r.sealed.length - 1], o = await f({ | ||
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], a = await f({ | ||
ciphertext: i, | ||
@@ -447,7 +447,7 @@ key: n | ||
return { | ||
id: r.id, | ||
status: r.status, | ||
version: r.version, | ||
metadata: r.metadata, | ||
data: o, | ||
id: s.id, | ||
status: s.status, | ||
version: s.version, | ||
metadata: s.metadata, | ||
data: a, | ||
key: n | ||
@@ -461,4 +461,4 @@ }; | ||
*/ | ||
async close(e) { | ||
const n = await fetch(`${this.endpoint}/${e}`, { | ||
async close(t) { | ||
const n = await fetch(`${this.endpoint}/${t}`, { | ||
method: "DELETE" | ||
@@ -470,3 +470,3 @@ }); | ||
} | ||
class k { | ||
class B { | ||
/** | ||
@@ -477,9 +477,9 @@ * Creates a new instance of the Notabene SDK | ||
*/ | ||
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; | ||
constructor(t) { | ||
o(this, "nodeUrl"); | ||
o(this, "authToken"); | ||
o(this, "uxUrl"); | ||
o(this, "theme"); | ||
o(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; | ||
} | ||
@@ -496,11 +496,11 @@ /** | ||
*/ | ||
componentUrl(e, n, s, r) { | ||
componentUrl(t, n, r, s) { | ||
const i = new URL(this.uxUrl); | ||
i.pathname = e; | ||
const o = R({ | ||
i.pathname = t; | ||
const a = M({ | ||
authToken: this.authToken, | ||
value: n, | ||
configuration: s | ||
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), r && (r.callback && i.searchParams.set("callback_url", r.callback), r.redirectUri && i.searchParams.set("redirect_uri", r.redirectUri)), i.toString(); | ||
return i.hash = a, 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(); | ||
} | ||
@@ -517,7 +517,7 @@ /** | ||
*/ | ||
createComponent(e, n, s, r) { | ||
createComponent(t, n, r, s) { | ||
return new x( | ||
this.componentUrl(e, n, s, r), | ||
this.componentUrl(t, n, r, s), | ||
n, | ||
s | ||
r | ||
); | ||
@@ -533,8 +533,8 @@ } | ||
*/ | ||
createWithdrawalAssist(e, n, s) { | ||
createWithdrawalAssist(t, n, r) { | ||
return this.createComponent( | ||
"withdrawal-assist", | ||
e, | ||
t, | ||
n, | ||
s | ||
r | ||
); | ||
@@ -551,8 +551,8 @@ } | ||
*/ | ||
createConnectWallet(e, n, s) { | ||
createConnectWallet(t, n, r) { | ||
return this.createComponent( | ||
"connect", | ||
e, | ||
t, | ||
n, | ||
s | ||
r | ||
); | ||
@@ -569,8 +569,8 @@ } | ||
*/ | ||
createDepositRequest(e, n, s) { | ||
createDepositRequest(t, n, r) { | ||
return this.createComponent( | ||
"deposit-request", | ||
e, | ||
t, | ||
n, | ||
s | ||
r | ||
); | ||
@@ -587,8 +587,8 @@ } | ||
*/ | ||
createDepositAssist(e, n, s) { | ||
createDepositAssist(t, n, r) { | ||
return this.createComponent( | ||
"deposit-assist", | ||
e, | ||
t, | ||
n, | ||
s | ||
r | ||
); | ||
@@ -598,17 +598,20 @@ } | ||
export { | ||
A as AgentType, | ||
g as AgentType, | ||
l as CMType, | ||
M as ConnectionManager, | ||
y as CodeVerificationStatus, | ||
T as ConnectionManager, | ||
x as EmbeddedComponent, | ||
b as ErrorIdentifierCode, | ||
E as HMType, | ||
_ as ErrorIdentifierCode, | ||
p as HMType, | ||
b as IdentityVerificationMethod, | ||
C as OAuthProvider, | ||
I as PersonType, | ||
C as ProofStatus, | ||
U as ProofTypes, | ||
y as Status, | ||
N as VASPSearchControl, | ||
L as ValidationSections, | ||
O as decodeFragmentToObject, | ||
k as default, | ||
S as getRefreshResult | ||
D as ProofStatus, | ||
R as ProofTypes, | ||
N as Status, | ||
L as VASPSearchControl, | ||
U as ValidationSections, | ||
k as decodeFragmentToObject, | ||
B as default, | ||
P as getRefreshResult | ||
}; |
@@ -13,3 +13,3 @@ { | ||
"packageManager": "yarn@4.5.1", | ||
"version": "2.11.0", | ||
"version": "2.12.0", | ||
"source": "src/notabene.ts", | ||
@@ -16,0 +16,0 @@ "main": "dist/cjs/notabene.cjs", |
@@ -16,2 +16,3 @@ import EmbeddedComponent from './components/EmbeddedComponent'; | ||
ConnectionRequest, | ||
CosmosMetadata, | ||
Counterparty, | ||
@@ -69,4 +70,7 @@ CounterpartyAssistConfig, | ||
CMType, | ||
CodeVerificationStatus, | ||
ErrorIdentifierCode, | ||
HMType, | ||
IdentityVerificationMethod, | ||
OAuthProvider, | ||
PersonType, | ||
@@ -96,5 +100,8 @@ ProofStatus, | ||
CMType, | ||
CodeVerificationStatus, | ||
decodeFragmentToObject, | ||
ErrorIdentifierCode, | ||
HMType, | ||
IdentityVerificationMethod, | ||
OAuthProvider, | ||
PersonType, | ||
@@ -121,2 +128,3 @@ ProofStatus, | ||
ConnectionRequest, | ||
CosmosMetadata, | ||
Counterparty, | ||
@@ -123,0 +131,0 @@ CounterpartyAssistConfig, |
@@ -564,2 +564,3 @@ import type { | ||
export interface Transaction extends ComponentRequest { | ||
transactionId?: string; | ||
agent: Agent; | ||
@@ -587,10 +588,2 @@ counterparty: Counterparty; | ||
/** | ||
* Extended transaction interface for deposits | ||
* @public | ||
*/ | ||
export interface DepositTransaction extends Transaction { | ||
transactionId?: string; // Optional transactionId of a Notabene transaction. Will be returned with the payload to assist updating the Transaction | ||
} | ||
/** | ||
* An object representing a withdrawal transaction | ||
@@ -608,6 +601,3 @@ * @public | ||
*/ | ||
export interface Deposit | ||
extends OriginatorFields, | ||
DepositTransaction, | ||
Refreshable {} | ||
export interface Deposit extends OriginatorFields, Transaction, Refreshable {} | ||
@@ -800,2 +790,43 @@ /** | ||
/** | ||
* Available methods for identity verification | ||
* @public | ||
*/ | ||
export enum IdentityVerificationMethod { | ||
SMS = 'sms', | ||
EMAIL = 'email', | ||
} | ||
/** | ||
* Status of a code verification | ||
* @public | ||
*/ | ||
export enum CodeVerificationStatus { | ||
PENDING = 'pending', | ||
APPROVED = 'approved', | ||
FAILED = 'failed', | ||
EXPIRED = 'expired', | ||
MAX_ATTEMPTS_REACHED = 'max_attempts_reached', | ||
UNREACHABLE = 'unreachable', | ||
} | ||
/** | ||
* Supported OAuth providers for authentication | ||
* @public | ||
*/ | ||
export enum OAuthProvider { | ||
COINBASE = 'coinbase', | ||
} | ||
/** | ||
* Configuration options for identity verification | ||
* @public | ||
*/ | ||
export type IdentityVerificationConfig = { | ||
/** The required verification method. If not specified, none will be used */ | ||
requiredMethod?: IdentityVerificationMethod; | ||
/** OAuth provider(s) to use for authentication. Can be a single provider or array of providers */ | ||
oAuth?: OAuthProvider[] | OAuthProvider; | ||
}; | ||
/** | ||
* Counterparty Assist Configuration options for recipient selection | ||
@@ -812,2 +843,3 @@ * | ||
counterpartyTypes: PersonType[]; | ||
identityVerification?: IdentityVerificationConfig; | ||
}; | ||
@@ -1153,2 +1185,3 @@ | ||
CIP8 = 'cip-8', | ||
COSMOS = 'cosmos-ecdsa', | ||
MicroTransfer = 'microtransfer', | ||
@@ -1245,2 +1278,12 @@ Screenshot = 'screenshot', | ||
/** | ||
* Metadata for Cosmos ownership proofs | ||
* @remarks | ||
* - Includes the public key | ||
* @public | ||
*/ | ||
export interface CosmosMetadata { | ||
pub_key: { type: string; value: string }; | ||
} | ||
/** | ||
* Interface for signature-based ownership proofs that use cryptographic message signing | ||
@@ -1278,3 +1321,4 @@ * | ||
| ProofTypes.CONCORDIUM | ||
| ProofTypes.XLM_ED25519; | ||
| ProofTypes.XLM_ED25519 | ||
| ProofTypes.COSMOS; | ||
@@ -1289,3 +1333,4 @@ proof: string; | ||
} | ||
| SolanaMetadata; | ||
| SolanaMetadata | ||
| CosmosMetadata; | ||
} | ||
@@ -1292,0 +1337,0 @@ |
@@ -18,2 +18,4 @@ import type { | ||
readonly result?: TransactionResponse<T>; | ||
readonly phoneNumber?: string; | ||
readonly email?: string; | ||
} | ||
@@ -20,0 +22,0 @@ |
Sorry, the diff of this file is not supported yet
627593
1.02%10828
1.91%