@bloque/sdk-identity 0.6.0 → 0.8.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/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__,{ApiKeysClient:()=>ApiKeysClient,OriginClient:()=>OriginClient,AliasesClient:()=>AliasesClient,IdentityClient:()=>IdentityClient,OriginsClient:()=>OriginsClient});const sdk_core_namespaceObject=require("@bloque/sdk-core");class AliasesClient extends sdk_core_namespaceObject.BaseClient{async get(e){return await this.httpClient.request({method:"GET",path:`/api/aliases?alias=${encodeURIComponent(e)}`})}}function mapApiKeyWire(e){return{id:e.id,keyId:e.key_id,publishableKey:e.publishable_key,name:e.name,scopes:e.scopes,domains:e.domains,status:e.status,expiration:e.expiration,metadata:e.metadata,lastUsedAt:e.last_used_at,createdAt:e.created_at}}class ApiKeysClient extends sdk_core_namespaceObject.BaseClient{async create(e){let t={name:e.name,scopes:e.scopes,domains:e.domains,expiration:e.expiration,metadata:e.metadata},i=await this.httpClient.request({method:"POST",path:"/api/api-keys",body:t});return{keyId:i.key_id,secretKey:i.secret_key,publishableKey:i.publishable_key}}async list(){return(await this.httpClient.request({method:"GET",path:"/api/api-keys"})).map(mapApiKeyWire)}async get(e){return mapApiKeyWire(await this.httpClient.request({method:"GET",path:`/api/api-keys/${e}`}))}async exchange(e){let t=await this.httpClient.request({method:"POST",path:"/api/api-keys/exchange",body:{key:e.key,scopes:e.scopes}});return{accessToken:t.access_token,expiresIn:t.expires_in,tokenType:t.token_type}}async revoke(e){await this.httpClient.request({method:"DELETE",path:`/api/api-keys/${e}`})}async rotate(e){return{secretKey:(await this.httpClient.request({method:"POST",path:`/api/api-keys/${e}/rotate`})).secret_key}}}class OriginClient extends sdk_core_namespaceObject.BaseClient{origin;constructor(e,t){super(e),this.origin=t}async assert(e){return await this.httpClient.request({method:"GET",path:`/api/origins/${this.origin}/assert?alias=${e}`})}}class OriginsClient extends sdk_core_namespaceObject.BaseClient{whatsapp;email;constructor(e){super(e),this.whatsapp=new OriginClient(e,"bloque-whatsapp"),this.email=new OriginClient(e,"bloque-email")}custom(e){return new OriginClient(this.httpClient,e)}async list(){return await this.httpClient.request({method:"GET",path:"/api/origins"})}async register(e,t,i){let a,s=i.assertionResult,n="API_KEY"===s.challengeType?{alias:s.alias,challengeType:"API_KEY",value:{api_key:s.value.apiKey,alias:e},originalChallengeParams:s.originalChallengeParams}:{alias:e,challengeType:s.challengeType,value:s.value,originalChallengeParams:s.originalChallengeParams};return a="individual"===i.type?{assertion_result:n,extra_context:i.extraContext,type:"individual",profile:this._mapUserProfile(i.profile)}:{assertion_result:n,extra_context:i.extraContext,type:"business",profile:this._mapBusinessProfile(i.profile)},{accessToken:(await this.httpClient.request({method:"POST",path:`/api/origins/${t}/register`,body:a})).result.access_token}}async updateMetadata(e){let t={};void 0!==e.metadata.company&&(t.company=e.metadata.company),void 0!==e.metadata.tosGateShowHome&&(t.tos_gate_show_home=e.metadata.tosGateShowHome),void 0!==e.metadata.gateAccentColor&&(t.gate_accent_color=e.metadata.gateAccentColor),void 0!==e.metadata.verificationGateReturnUrlAllowlist&&(t.verification_gate_return_url_allowlist=e.metadata.verificationGateReturnUrlAllowlist);let i=await this.httpClient.request({method:"PATCH",path:`/api/origins/${e.originName}/metadata`,body:{api_key:e.apiKey,metadata:t},_skipExchange:!0});return{originName:i.origin_name,metadata:i.metadata,updated:!0}}_mapUserProfile(e){return{first_name:e.firstName,last_name:e.lastName,birthdate:e.birthdate,email:e.email,phone:e.phone,gender:e.gender,address_line1:e.addressLine1,address_line2:e.addressLine2,city:e.city,state:e.state,postal_code:e.postalCode,neighborhood:e.neighborhood,country_of_birth_code:e.countryOfBirthCode,country_of_residence_code:e.countryOfResidenceCode,personal_id_type:e.personalIdType,personal_id_number:e.personalIdNumber}}_mapBusinessProfile(e){return{address_line1:e.addressLine1,city:e.city,country:e.country,incorporation_date:e.incorporationDate,legal_name:e.legalName,name:e.name,postal_code:e.postalCode,state:e.state,tax_id:e.taxId,type:e.type,address_line2:e.addressLine2,country_code:e.countryCode,email:e.email,logo:e.logo,owner_address_line1:e.ownerAddressLine1,owner_address_line2:e.ownerAddressLine2,owner_city:e.ownerCity,owner_country_code:e.ownerCountryCode,owner_id_number:e.ownerIdNumber,owner_id_type:e.ownerIdType,owner_name:e.ownerName,owner_postal_code:e.ownerPostalCode,owner_state:e.ownerState,phone:e.phone}}}class IdentityClient{httpClient;aliases;apiKeys;origins;constructor(e){this.httpClient=e,this.aliases=new AliasesClient(this.httpClient),this.apiKeys=new ApiKeysClient(this.httpClient),this.origins=new OriginsClient(this.httpClient)}async me(){return await this.httpClient.request({method:"GET",path:"/api/identities/me"})}async updateMe(e){return(await this.httpClient.request({method:"PATCH",path:"/api/identities/me",body:e})).result.identity}async myAliases(){return await this.httpClient.request({method:"GET",path:"/api/identities/me/aliases"})}async get(e){return await this.httpClient.request({method:"GET",path:`/api/identities/${e}`})}async update(e,t){return(await this.httpClient.request({method:"PATCH",path:`/api/identities/${e}`,body:t})).result.identity}async getAliases(e){return await this.httpClient.request({method:"GET",path:`/api/identities/${e}/aliases`})}}for(var __rspack_i in exports.AliasesClient=__webpack_exports__.AliasesClient,exports.ApiKeysClient=__webpack_exports__.ApiKeysClient,exports.IdentityClient=__webpack_exports__.IdentityClient,exports.OriginClient=__webpack_exports__.OriginClient,exports.OriginsClient=__webpack_exports__.OriginsClient,__webpack_exports__)-1===["AliasesClient","ApiKeysClient","IdentityClient","OriginClient","OriginsClient"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
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__,{ApiKeysClient:()=>ApiKeysClient,OriginClient:()=>OriginClient,AliasesClient:()=>AliasesClient,IdentityClient:()=>IdentityClient,OriginsClient:()=>OriginsClient});const sdk_core_namespaceObject=require("@bloque/sdk-core");class AliasesClient extends sdk_core_namespaceObject.BaseClient{async get(e){return await this.httpClient.request({method:"GET",path:`/api/aliases?alias=${encodeURIComponent(e)}`})}}function mapApiKeyWire(e){return{id:e.id,keyId:e.key_id,publishableKey:e.publishable_key,name:e.name,scopes:e.scopes,domains:e.domains,status:e.status,expiration:e.expiration,metadata:e.metadata,lastUsedAt:e.last_used_at,createdAt:e.created_at}}class ApiKeysClient extends sdk_core_namespaceObject.BaseClient{async create(e){let t={name:e.name,scopes:e.scopes,domains:e.domains,expiration:e.expiration,metadata:e.metadata},i=await this.httpClient.request({method:"POST",path:"/api/api-keys",body:t});return{keyId:i.key_id,secretKey:i.secret_key,publishableKey:i.publishable_key}}async list(){return(await this.httpClient.request({method:"GET",path:"/api/api-keys"})).map(mapApiKeyWire)}async get(e){return mapApiKeyWire(await this.httpClient.request({method:"GET",path:`/api/api-keys/${e}`}))}async exchange(e){let t=await this.httpClient.request({method:"POST",path:"/api/api-keys/exchange",body:{key:e.key,scopes:e.scopes}});return{accessToken:t.access_token,expiresIn:t.expires_in,tokenType:t.token_type}}async revoke(e){await this.httpClient.request({method:"DELETE",path:`/api/api-keys/${e}`})}async rotate(e){return{secretKey:(await this.httpClient.request({method:"POST",path:`/api/api-keys/${e}/rotate`})).secret_key}}}class OriginClient extends sdk_core_namespaceObject.BaseClient{origin;constructor(e,t){super(e),this.origin=t}async assert(e){return await this.httpClient.request({method:"GET",path:`/api/origins/${this.origin}/assert?alias=${e}`})}}class OriginsClient extends sdk_core_namespaceObject.BaseClient{whatsapp;email;constructor(e){super(e),this.whatsapp=new OriginClient(e,"bloque-whatsapp"),this.email=new OriginClient(e,"bloque-email")}custom(e){return new OriginClient(this.httpClient,e)}async list(){return await this.httpClient.request({method:"GET",path:"/api/origins"})}async register(e,t,i){let a,s=i.assertionResult,n="API_KEY"===s.challengeType?{alias:s.alias,challengeType:"API_KEY",value:{api_key:s.value.apiKey,alias:e},originalChallengeParams:s.originalChallengeParams}:{alias:e,challengeType:s.challengeType,value:s.value,originalChallengeParams:s.originalChallengeParams};return a="individual"===i.type?{assertion_result:n,extra_context:i.extraContext,type:"individual",profile:this._mapUserProfile(i.profile)}:{assertion_result:n,extra_context:i.extraContext,type:"business",profile:this._mapBusinessProfile(i.profile)},{accessToken:(await this.httpClient.request({method:"POST",path:`/api/origins/${t}/register`,body:a,headers:i.clientIp?{"x-original-client-ip":i.clientIp}:void 0})).result.access_token}}_mapUserProfile(e){return{first_name:e.firstName,last_name:e.lastName,birthdate:e.birthdate,email:e.email,phone:e.phone,gender:e.gender,address_line1:e.addressLine1,address_line2:e.addressLine2,city:e.city,state:e.state,postal_code:e.postalCode,neighborhood:e.neighborhood,country_of_birth_code:e.countryOfBirthCode,country_of_residence_code:e.countryOfResidenceCode,personal_id_type:e.personalIdType,personal_id_number:e.personalIdNumber}}_mapBusinessProfile(e){return{address_line1:e.addressLine1,city:e.city,country:e.country,incorporation_date:e.incorporationDate,legal_name:e.legalName,name:e.name,postal_code:e.postalCode,state:e.state,tax_id:e.taxId,type:e.type,address_line2:e.addressLine2,country_code:e.countryCode,email:e.email,logo:e.logo,owner_address_line1:e.ownerAddressLine1,owner_address_line2:e.ownerAddressLine2,owner_city:e.ownerCity,owner_country_code:e.ownerCountryCode,owner_id_number:e.ownerIdNumber,owner_id_type:e.ownerIdType,owner_name:e.ownerName,owner_postal_code:e.ownerPostalCode,owner_state:e.ownerState,phone:e.phone}}}class IdentityClient{httpClient;aliases;apiKeys;origins;constructor(e){this.httpClient=e,this.aliases=new AliasesClient(this.httpClient),this.apiKeys=new ApiKeysClient(this.httpClient),this.origins=new OriginsClient(this.httpClient)}async me(){return await this.httpClient.request({method:"GET",path:"/api/identities/me"})}async updateMe(e){return(await this.httpClient.request({method:"PATCH",path:"/api/identities/me",body:e})).result.identity}async myAliases(){return await this.httpClient.request({method:"GET",path:"/api/identities/me/aliases"})}async get(e){return await this.httpClient.request({method:"GET",path:`/api/identities/${e}`})}async update(e,t){return(await this.httpClient.request({method:"PATCH",path:`/api/identities/${e}`,body:t})).result.identity}async getAliases(e){return await this.httpClient.request({method:"GET",path:`/api/identities/${e}/aliases`})}}for(var __rspack_i in exports.AliasesClient=__webpack_exports__.AliasesClient,exports.ApiKeysClient=__webpack_exports__.ApiKeysClient,exports.IdentityClient=__webpack_exports__.IdentityClient,exports.OriginClient=__webpack_exports__.OriginClient,exports.OriginsClient=__webpack_exports__.OriginsClient,__webpack_exports__)-1===["AliasesClient","ApiKeysClient","IdentityClient","OriginClient","OriginsClient"].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{BaseClient as e}from"@bloque/sdk-core";class t extends e{async get(e){return await this.httpClient.request({method:"GET",path:`/api/aliases?alias=${encodeURIComponent(e)}`})}}function a(e){return{id:e.id,keyId:e.key_id,publishableKey:e.publishable_key,name:e.name,scopes:e.scopes,domains:e.domains,status:e.status,expiration:e.expiration,metadata:e.metadata,lastUsedAt:e.last_used_at,createdAt:e.created_at}}class i extends e{async create(e){let t={name:e.name,scopes:e.scopes,domains:e.domains,expiration:e.expiration,metadata:e.metadata},a=await this.httpClient.request({method:"POST",path:"/api/api-keys",body:t});return{keyId:a.key_id,secretKey:a.secret_key,publishableKey:a.publishable_key}}async list(){return(await this.httpClient.request({method:"GET",path:"/api/api-keys"})).map(a)}async get(e){return a(await this.httpClient.request({method:"GET",path:`/api/api-keys/${e}`}))}async exchange(e){let t=await this.httpClient.request({method:"POST",path:"/api/api-keys/exchange",body:{key:e.key,scopes:e.scopes}});return{accessToken:t.access_token,expiresIn:t.expires_in,tokenType:t.token_type}}async revoke(e){await this.httpClient.request({method:"DELETE",path:`/api/api-keys/${e}`})}async rotate(e){return{secretKey:(await this.httpClient.request({method:"POST",path:`/api/api-keys/${e}/rotate`})).secret_key}}}class s extends e{origin;constructor(e,t){super(e),this.origin=t}async assert(e){return await this.httpClient.request({method:"GET",path:`/api/origins/${this.origin}/assert?alias=${e}`})}}class n extends e{whatsapp;email;constructor(e){super(e),this.whatsapp=new s(e,"bloque-whatsapp"),this.email=new s(e,"bloque-email")}custom(e){return new s(this.httpClient,e)}async list(){return await this.httpClient.request({method:"GET",path:"/api/origins"})}async register(e,t,a){let i,s=a.assertionResult,n="API_KEY"===s.challengeType?{alias:s.alias,challengeType:"API_KEY",value:{api_key:s.value.apiKey,alias:e},originalChallengeParams:s.originalChallengeParams}:{alias:e,challengeType:s.challengeType,value:s.value,originalChallengeParams:s.originalChallengeParams};return i="individual"===a.type?{assertion_result:n,extra_context:a.extraContext,type:"individual",profile:this._mapUserProfile(a.profile)}:{assertion_result:n,extra_context:a.extraContext,type:"business",profile:this._mapBusinessProfile(a.profile)},{accessToken:(await this.httpClient.request({method:"POST",path:`/api/origins/${t}/register`,body:i})).result.access_token}}async updateMetadata(e){let t={};void 0!==e.metadata.company&&(t.company=e.metadata.company),void 0!==e.metadata.tosGateShowHome&&(t.tos_gate_show_home=e.metadata.tosGateShowHome),void 0!==e.metadata.gateAccentColor&&(t.gate_accent_color=e.metadata.gateAccentColor),void 0!==e.metadata.verificationGateReturnUrlAllowlist&&(t.verification_gate_return_url_allowlist=e.metadata.verificationGateReturnUrlAllowlist);let a=await this.httpClient.request({method:"PATCH",path:`/api/origins/${e.originName}/metadata`,body:{api_key:e.apiKey,metadata:t},_skipExchange:!0});return{originName:a.origin_name,metadata:a.metadata,updated:!0}}_mapUserProfile(e){return{first_name:e.firstName,last_name:e.lastName,birthdate:e.birthdate,email:e.email,phone:e.phone,gender:e.gender,address_line1:e.addressLine1,address_line2:e.addressLine2,city:e.city,state:e.state,postal_code:e.postalCode,neighborhood:e.neighborhood,country_of_birth_code:e.countryOfBirthCode,country_of_residence_code:e.countryOfResidenceCode,personal_id_type:e.personalIdType,personal_id_number:e.personalIdNumber}}_mapBusinessProfile(e){return{address_line1:e.addressLine1,city:e.city,country:e.country,incorporation_date:e.incorporationDate,legal_name:e.legalName,name:e.name,postal_code:e.postalCode,state:e.state,tax_id:e.taxId,type:e.type,address_line2:e.addressLine2,country_code:e.countryCode,email:e.email,logo:e.logo,owner_address_line1:e.ownerAddressLine1,owner_address_line2:e.ownerAddressLine2,owner_city:e.ownerCity,owner_country_code:e.ownerCountryCode,owner_id_number:e.ownerIdNumber,owner_id_type:e.ownerIdType,owner_name:e.ownerName,owner_postal_code:e.ownerPostalCode,owner_state:e.ownerState,phone:e.phone}}}class r{httpClient;aliases;apiKeys;origins;constructor(e){this.httpClient=e,this.aliases=new t(this.httpClient),this.apiKeys=new i(this.httpClient),this.origins=new n(this.httpClient)}async me(){return await this.httpClient.request({method:"GET",path:"/api/identities/me"})}async updateMe(e){return(await this.httpClient.request({method:"PATCH",path:"/api/identities/me",body:e})).result.identity}async myAliases(){return await this.httpClient.request({method:"GET",path:"/api/identities/me/aliases"})}async get(e){return await this.httpClient.request({method:"GET",path:`/api/identities/${e}`})}async update(e,t){return(await this.httpClient.request({method:"PATCH",path:`/api/identities/${e}`,body:t})).result.identity}async getAliases(e){return await this.httpClient.request({method:"GET",path:`/api/identities/${e}/aliases`})}}export{t as AliasesClient,i as ApiKeysClient,r as IdentityClient,s as OriginClient,n as OriginsClient};
1
+ import{BaseClient as e}from"@bloque/sdk-core";class t extends e{async get(e){return await this.httpClient.request({method:"GET",path:`/api/aliases?alias=${encodeURIComponent(e)}`})}}function a(e){return{id:e.id,keyId:e.key_id,publishableKey:e.publishable_key,name:e.name,scopes:e.scopes,domains:e.domains,status:e.status,expiration:e.expiration,metadata:e.metadata,lastUsedAt:e.last_used_at,createdAt:e.created_at}}class i extends e{async create(e){let t={name:e.name,scopes:e.scopes,domains:e.domains,expiration:e.expiration,metadata:e.metadata},a=await this.httpClient.request({method:"POST",path:"/api/api-keys",body:t});return{keyId:a.key_id,secretKey:a.secret_key,publishableKey:a.publishable_key}}async list(){return(await this.httpClient.request({method:"GET",path:"/api/api-keys"})).map(a)}async get(e){return a(await this.httpClient.request({method:"GET",path:`/api/api-keys/${e}`}))}async exchange(e){let t=await this.httpClient.request({method:"POST",path:"/api/api-keys/exchange",body:{key:e.key,scopes:e.scopes}});return{accessToken:t.access_token,expiresIn:t.expires_in,tokenType:t.token_type}}async revoke(e){await this.httpClient.request({method:"DELETE",path:`/api/api-keys/${e}`})}async rotate(e){return{secretKey:(await this.httpClient.request({method:"POST",path:`/api/api-keys/${e}/rotate`})).secret_key}}}class s extends e{origin;constructor(e,t){super(e),this.origin=t}async assert(e){return await this.httpClient.request({method:"GET",path:`/api/origins/${this.origin}/assert?alias=${e}`})}}class n extends e{whatsapp;email;constructor(e){super(e),this.whatsapp=new s(e,"bloque-whatsapp"),this.email=new s(e,"bloque-email")}custom(e){return new s(this.httpClient,e)}async list(){return await this.httpClient.request({method:"GET",path:"/api/origins"})}async register(e,t,a){let i,s=a.assertionResult,n="API_KEY"===s.challengeType?{alias:s.alias,challengeType:"API_KEY",value:{api_key:s.value.apiKey,alias:e},originalChallengeParams:s.originalChallengeParams}:{alias:e,challengeType:s.challengeType,value:s.value,originalChallengeParams:s.originalChallengeParams};return i="individual"===a.type?{assertion_result:n,extra_context:a.extraContext,type:"individual",profile:this._mapUserProfile(a.profile)}:{assertion_result:n,extra_context:a.extraContext,type:"business",profile:this._mapBusinessProfile(a.profile)},{accessToken:(await this.httpClient.request({method:"POST",path:`/api/origins/${t}/register`,body:i,headers:a.clientIp?{"x-original-client-ip":a.clientIp}:void 0})).result.access_token}}_mapUserProfile(e){return{first_name:e.firstName,last_name:e.lastName,birthdate:e.birthdate,email:e.email,phone:e.phone,gender:e.gender,address_line1:e.addressLine1,address_line2:e.addressLine2,city:e.city,state:e.state,postal_code:e.postalCode,neighborhood:e.neighborhood,country_of_birth_code:e.countryOfBirthCode,country_of_residence_code:e.countryOfResidenceCode,personal_id_type:e.personalIdType,personal_id_number:e.personalIdNumber}}_mapBusinessProfile(e){return{address_line1:e.addressLine1,city:e.city,country:e.country,incorporation_date:e.incorporationDate,legal_name:e.legalName,name:e.name,postal_code:e.postalCode,state:e.state,tax_id:e.taxId,type:e.type,address_line2:e.addressLine2,country_code:e.countryCode,email:e.email,logo:e.logo,owner_address_line1:e.ownerAddressLine1,owner_address_line2:e.ownerAddressLine2,owner_city:e.ownerCity,owner_country_code:e.ownerCountryCode,owner_id_number:e.ownerIdNumber,owner_id_type:e.ownerIdType,owner_name:e.ownerName,owner_postal_code:e.ownerPostalCode,owner_state:e.ownerState,phone:e.phone}}}class r{httpClient;aliases;apiKeys;origins;constructor(e){this.httpClient=e,this.aliases=new t(this.httpClient),this.apiKeys=new i(this.httpClient),this.origins=new n(this.httpClient)}async me(){return await this.httpClient.request({method:"GET",path:"/api/identities/me"})}async updateMe(e){return(await this.httpClient.request({method:"PATCH",path:"/api/identities/me",body:e})).result.identity}async myAliases(){return await this.httpClient.request({method:"GET",path:"/api/identities/me/aliases"})}async get(e){return await this.httpClient.request({method:"GET",path:`/api/identities/${e}`})}async update(e,t){return(await this.httpClient.request({method:"PATCH",path:`/api/identities/${e}`,body:t})).result.identity}async getAliases(e){return await this.httpClient.request({method:"GET",path:`/api/identities/${e}/aliases`})}}export{t as AliasesClient,i as ApiKeysClient,r as IdentityClient,s as OriginClient,n as OriginsClient};
@@ -2,7 +2,7 @@ import type { HttpClient } from '@bloque/sdk-core';
2
2
  import { BaseClient } from '@bloque/sdk-core';
3
3
  import type { Origin, OTPAssertion, OTPAssertionEmail, OTPAssertionWhatsApp } from '../internal/wire-types';
4
4
  import { OriginClient } from './origin-client';
5
- import type { RegisterParams, RegisterResult, UpdateOriginMetadataParams, UpdateOriginMetadataResult } from './types';
5
+ import type { RegisterParams, RegisterResult } from './types';
6
6
  export declare class OriginsClient extends BaseClient {
7
7
  readonly whatsapp: OriginClient<OTPAssertionWhatsApp>;
8
8
  readonly email: OriginClient<OTPAssertionEmail>;
@@ -50,7 +50,10 @@ export declare class OriginsClient extends BaseClient {
50
50
  * - **PASSWORD**: Password-based authentication
51
51
  *
52
52
  * @param origin - The origin namespace to register the identity to (e.g., 'ethereum-mainnet', 'bloque-api')
53
- * @param params - Registration data including assertion result and profile information
53
+ * @param params - Registration data including assertion result and profile information.
54
+ * For `API_KEY` challenges (your server registering on the user's behalf), pass their
55
+ * real IP as `clientIp` so Bloque resolves usage country and audits decisions against
56
+ * the end user rather than your server.
54
57
  * @returns Promise resolving to the registration result with access token
55
58
  *
56
59
  * @example
@@ -120,36 +123,6 @@ export declare class OriginsClient extends BaseClient {
120
123
  * ```
121
124
  */
122
125
  register(alias: string, origin: string, params: RegisterParams): Promise<RegisterResult>;
123
- /**
124
- * Self-service update of an API-key origin's own presentation metadata:
125
- * `company`, `tosGateShowHome`, `gateAccentColor`, and
126
- * `verificationGateReturnUrlAllowlist`. Authenticated purely by the
127
- * origin's own `apiKey` in the request body — no session/JWT involved,
128
- * and works even before you've ever called `connect()`/`register()`.
129
- *
130
- * This is a one-time, deploy-script-shaped call, not something you run
131
- * per-request or per-user. Fields you omit from `metadata` are left
132
- * untouched on the origin (shallow merge) — the response echoes the full
133
- * post-merge metadata so you can confirm what actually took effect.
134
- *
135
- * @param params - Origin to patch, its own secret key, and the metadata patch
136
- * @returns Promise resolving to the origin's full metadata after the merge
137
- *
138
- * @example
139
- * ```typescript
140
- * const result = await bloque.identity.origins.updateMetadata({
141
- * originName: 'acme',
142
- * apiKey: process.env.ACME_ORIGIN_KEY!,
143
- * metadata: {
144
- * company: 'Acme Inc.',
145
- * gateAccentColor: '#1a73e8',
146
- * verificationGateReturnUrlAllowlist: ['https://app.acme.example.com'],
147
- * },
148
- * });
149
- * console.log(result.updated); // true
150
- * ```
151
- */
152
- updateMetadata(params: UpdateOriginMetadataParams): Promise<UpdateOriginMetadataResult>;
153
126
  private _mapUserProfile;
154
127
  private _mapBusinessProfile;
155
128
  }
@@ -166,6 +166,16 @@ export interface IndividualRegisterParams {
166
166
  * User profile information
167
167
  */
168
168
  profile: UserProfile;
169
+ /**
170
+ * The end user's own IP address, forwarded from your server so Bloque can
171
+ * resolve their real usage country and record it on the compliance audit
172
+ * trail — instead of falling back to your server's own IP. Only honored
173
+ * for `API_KEY`-challenge registrations (your server calling on the
174
+ * user's behalf); silently ignored otherwise, since Bloque can already
175
+ * see the caller's real IP for interactive challenge types.
176
+ * @example "190.85.12.4"
177
+ */
178
+ clientIp?: string;
169
179
  }
170
180
  export interface BusinessRegisterParams {
171
181
  /**
@@ -184,6 +194,16 @@ export interface BusinessRegisterParams {
184
194
  * Business profile information
185
195
  */
186
196
  profile: BusinessProfile;
197
+ /**
198
+ * The end user's own IP address, forwarded from your server so Bloque can
199
+ * resolve their real usage country and record it on the compliance audit
200
+ * trail — instead of falling back to your server's own IP. Only honored
201
+ * for `API_KEY`-challenge registrations (your server calling on the
202
+ * user's behalf); silently ignored otherwise, since Bloque can already
203
+ * see the caller's real IP for interactive challenge types.
204
+ * @example "190.85.12.4"
205
+ */
206
+ clientIp?: string;
187
207
  }
188
208
  export type RegisterParams = IndividualRegisterParams | BusinessRegisterParams;
189
209
  export interface RegisterResult {
@@ -192,58 +212,4 @@ export interface RegisterResult {
192
212
  */
193
213
  accessToken: string;
194
214
  }
195
- /**
196
- * Self-serviceable presentation metadata for an API-key origin. This is the
197
- * complete allowlist accepted by `OriginsClient.updateMetadata()` — any other
198
- * field on `Origin.metadata` (e.g. `contactEmail`) is owned by other systems
199
- * and can't be set through this surface.
200
- */
201
- export interface OriginMetadataPatch {
202
- /**
203
- * Developer-facing display name substituted as `{{developer_name}}` into
204
- * the hosted TOS document. Non-empty, at most 200 characters.
205
- */
206
- company?: string;
207
- /** Skip the hosted TOS gate's intro screens. */
208
- tosGateShowHome?: boolean;
209
- /**
210
- * Brand accent color applied to both hosted gates' `--accent` CSS
211
- * variable. Strict 3- or 6-digit CSS hex (e.g. `#f80` or `#ff8800`) —
212
- * anything else is silently dropped server-side, never partially applied.
213
- */
214
- gateAccentColor?: string;
215
- /**
216
- * Bare origins (scheme + host + port, no path or trailing slash) allowed
217
- * as `returnUrl` on `compliance.verificationGate.start()`, in addition to
218
- * the deployment-wide `VERIFICATION_GATE_RETURN_URL_ALLOWLIST` env var —
219
- * either being satisfied is enough. Replaces the whole array; it does not
220
- * append to whatever is already configured.
221
- */
222
- verificationGateReturnUrlAllowlist?: string[];
223
- }
224
- export interface UpdateOriginMetadataParams {
225
- /**
226
- * Origin namespace to patch — the same value passed as `origin` to
227
- * `new SDK(...)`.
228
- */
229
- originName: string;
230
- /**
231
- * The origin's own provisioned secret key (`sk_live_...`/`sk_test_...`),
232
- * verified server-side against `origin_key_values` — not a
233
- * dashboard-issued API key.
234
- */
235
- apiKey: string;
236
- /**
237
- * Shallow-merged into the origin's existing metadata: fields you omit are
238
- * left untouched.
239
- */
240
- metadata: OriginMetadataPatch;
241
- }
242
- export interface UpdateOriginMetadataResult {
243
- /** Origin namespace that was updated. */
244
- originName: string;
245
- /** The origin's full metadata after the patch was merged in. */
246
- metadata: Record<string, unknown>;
247
- updated: true;
248
- }
249
215
  export {};
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { BusinessRegisterParams, IndividualRegisterParams } from './origins/types';
2
- export type CreateIdentityParams = Pick<IndividualRegisterParams, 'extraContext' | 'type' | 'profile'> | Pick<BusinessRegisterParams, 'extraContext' | 'type' | 'profile'>;
2
+ export type CreateIdentityParams = Pick<IndividualRegisterParams, 'extraContext' | 'type' | 'profile' | 'clientIp'> | Pick<BusinessRegisterParams, 'extraContext' | 'type' | 'profile' | 'clientIp'>;
3
3
  /**
4
4
  * Parameters for updating the current user's identity
5
5
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloque/sdk-identity",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "bloque",