@bloque/sdk 0.0.35 → 0.0.37
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/bloque.d.ts +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +7 -7
package/dist/bloque.d.ts
CHANGED
|
@@ -11,6 +11,15 @@ export declare class SDK {
|
|
|
11
11
|
private buildClients;
|
|
12
12
|
private getApiKey;
|
|
13
13
|
private buildUrn;
|
|
14
|
+
authenticateWithToken(token: string, alias: string): {
|
|
15
|
+
accounts: AccountsClient;
|
|
16
|
+
compliance: ComplianceClient;
|
|
17
|
+
identity: IdentityClient;
|
|
18
|
+
orgs: OrgsClient;
|
|
19
|
+
swap: SwapClient;
|
|
20
|
+
urn: string | undefined;
|
|
21
|
+
readonly accessToken: string;
|
|
22
|
+
};
|
|
14
23
|
register(alias: string, params: CreateIdentityParams): Promise<{
|
|
15
24
|
accounts: AccountsClient;
|
|
16
25
|
compliance: ComplianceClient;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{SDK:()=>SDK});const sdk_accounts_namespaceObject=require("@bloque/sdk-accounts"),sdk_compliance_namespaceObject=require("@bloque/sdk-compliance"),sdk_core_namespaceObject=require("@bloque/sdk-core"),sdk_identity_namespaceObject=require("@bloque/sdk-identity"),sdk_orgs_namespaceObject=require("@bloque/sdk-orgs"),sdk_swap_namespaceObject=require("@bloque/sdk-swap");class SDK{httpClient;identity;constructor(e){this.httpClient=new sdk_core_namespaceObject.HttpClient(e),this.identity=new sdk_identity_namespaceObject.IdentityClient(this.httpClient)}buildClients(e){return{accounts:new sdk_accounts_namespaceObject.AccountsClient(this.httpClient),compliance:new sdk_compliance_namespaceObject.ComplianceClient(this.httpClient),identity:this.identity,orgs:new sdk_orgs_namespaceObject.OrgsClient(this.httpClient),swap:new sdk_swap_namespaceObject.SwapClient(this.httpClient),urn:this.httpClient.urn,get accessToken(){return e}}}getApiKey(){let{auth:e}=this.httpClient;return"apiKey"===e.type?e.apiKey:""}buildUrn(e){let t=this.httpClient.origin;if(!t)throw Error("Origin is required to build a urn");return`did:bloque:${t}:${e}`}async register(e,t){t.extraContext||(t.extraContext={});let i=this.buildUrn(e),
|
|
1
|
+
"use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{SDK:()=>SDK});const sdk_accounts_namespaceObject=require("@bloque/sdk-accounts"),sdk_compliance_namespaceObject=require("@bloque/sdk-compliance"),sdk_core_namespaceObject=require("@bloque/sdk-core"),sdk_identity_namespaceObject=require("@bloque/sdk-identity"),sdk_orgs_namespaceObject=require("@bloque/sdk-orgs"),sdk_swap_namespaceObject=require("@bloque/sdk-swap");class SDK{httpClient;identity;constructor(e){this.httpClient=new sdk_core_namespaceObject.HttpClient(e),this.identity=new sdk_identity_namespaceObject.IdentityClient(this.httpClient)}buildClients(e){return{accounts:new sdk_accounts_namespaceObject.AccountsClient(this.httpClient),compliance:new sdk_compliance_namespaceObject.ComplianceClient(this.httpClient),identity:this.identity,orgs:new sdk_orgs_namespaceObject.OrgsClient(this.httpClient),swap:new sdk_swap_namespaceObject.SwapClient(this.httpClient),urn:this.httpClient.urn,get accessToken(){return e}}}getApiKey(){let{auth:e}=this.httpClient;return"apiKey"===e.type?e.apiKey:""}buildUrn(e){let t=this.httpClient.origin;if(!t)throw Error("Origin is required to build a urn");return`did:bloque:${t}:${e}`}authenticateWithToken(e,t){if(!e?.trim())throw Error("Token is required");let{auth:i}=this.httpClient;if("jwt"!==i.type)throw Error("authenticateWithToken is only available for JWT auth");return this.httpClient.setJwtToken(e),this.httpClient.setUrn(this.buildUrn(t)),this.buildClients(e)}async register(e,t){t.extraContext||(t.extraContext={});let i=this.buildUrn(e),r=this.httpClient.origin,s=await this.identity.origins.register(e,r,{assertionResult:{alias:e,challengeType:"API_KEY",value:{apiKey:this.getApiKey(),alias:e}},...t});return this.httpClient.setAccessToken(s.accessToken),this.httpClient.setUrn(i),this.buildClients(s.accessToken)}async connect(e){let t=this.buildUrn(e),i=this.httpClient.origin,r=await this.httpClient.request({path:`/api/origins/${i}/connect`,method:"POST",body:{assertion_result:{challengeType:"API_KEY",value:{api_key:this.getApiKey(),alias:e}},extra_context:{}}});return this.httpClient.setAccessToken(r.result.access_token),this.httpClient.setUrn(t),this.buildClients(r.result.access_token)}}for(var __rspack_i in exports.SDK=__webpack_exports__.SDK,__webpack_exports__)-1===["SDK"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AccountsClient as t}from"@bloque/sdk-accounts";import{ComplianceClient as e}from"@bloque/sdk-compliance";import{HttpClient as i}from"@bloque/sdk-core";import{IdentityClient as
|
|
1
|
+
import{AccountsClient as t}from"@bloque/sdk-accounts";import{ComplianceClient as e}from"@bloque/sdk-compliance";import{HttpClient as i}from"@bloque/sdk-core";import{IdentityClient as n}from"@bloque/sdk-identity";import{OrgsClient as s}from"@bloque/sdk-orgs";import{SwapClient as r}from"@bloque/sdk-swap";class l{httpClient;identity;constructor(t){this.httpClient=new i(t),this.identity=new n(this.httpClient)}buildClients(i){return{accounts:new t(this.httpClient),compliance:new e(this.httpClient),identity:this.identity,orgs:new s(this.httpClient),swap:new r(this.httpClient),urn:this.httpClient.urn,get accessToken(){return i}}}getApiKey(){let{auth:t}=this.httpClient;return"apiKey"===t.type?t.apiKey:""}buildUrn(t){let e=this.httpClient.origin;if(!e)throw Error("Origin is required to build a urn");return`did:bloque:${e}:${t}`}authenticateWithToken(t,e){if(!t?.trim())throw Error("Token is required");let{auth:i}=this.httpClient;if("jwt"!==i.type)throw Error("authenticateWithToken is only available for JWT auth");return this.httpClient.setJwtToken(t),this.httpClient.setUrn(this.buildUrn(e)),this.buildClients(t)}async register(t,e){e.extraContext||(e.extraContext={});let i=this.buildUrn(t),n=this.httpClient.origin,s=await this.identity.origins.register(t,n,{assertionResult:{alias:t,challengeType:"API_KEY",value:{apiKey:this.getApiKey(),alias:t}},...e});return this.httpClient.setAccessToken(s.accessToken),this.httpClient.setUrn(i),this.buildClients(s.accessToken)}async connect(t){let e=this.buildUrn(t),i=this.httpClient.origin,n=await this.httpClient.request({path:`/api/origins/${i}/connect`,method:"POST",body:{assertion_result:{challengeType:"API_KEY",value:{api_key:this.getApiKey(),alias:t}},extra_context:{}}});return this.httpClient.setAccessToken(n.result.access_token),this.httpClient.setUrn(e),this.buildClients(n.result.access_token)}}export{l as SDK};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloque/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"description": "Official Bloque SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -68,11 +68,11 @@
|
|
|
68
68
|
"node": ">=22"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@bloque/sdk-accounts": "0.0.
|
|
72
|
-
"@bloque/sdk-compliance": "0.0.
|
|
73
|
-
"@bloque/sdk-core": "0.0.
|
|
74
|
-
"@bloque/sdk-identity": "0.0.
|
|
75
|
-
"@bloque/sdk-orgs": "0.0.
|
|
76
|
-
"@bloque/sdk-swap": "0.0.
|
|
71
|
+
"@bloque/sdk-accounts": "0.0.37",
|
|
72
|
+
"@bloque/sdk-compliance": "0.0.37",
|
|
73
|
+
"@bloque/sdk-core": "0.0.37",
|
|
74
|
+
"@bloque/sdk-identity": "0.0.37",
|
|
75
|
+
"@bloque/sdk-orgs": "0.0.37",
|
|
76
|
+
"@bloque/sdk-swap": "0.0.37"
|
|
77
77
|
}
|
|
78
78
|
}
|