@dfinity/agent
Advanced tools
Comparing version 0.6.1 to 0.6.2
{ | ||
"name": "@dfinity/agent", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"main": "src/index.js", | ||
@@ -16,3 +16,3 @@ "scripts": { | ||
"dependencies": { | ||
"base64-js": "1.3.1", | ||
"base32.js": "^0.1.0", | ||
"bignumber.js": "^9.0.0", | ||
@@ -23,2 +23,3 @@ "borc": "^2.1.1", | ||
"crc": "3.8.0", | ||
"js-sha256": "0.9.0", | ||
"simple-cbor": "^0.4.0", | ||
@@ -29,3 +30,2 @@ "tweetnacl": "^1.0.1" | ||
"@trust/webcrypto": "^0.9.2", | ||
"@types/base64-js": "^1.2.5", | ||
"@types/crc": "^3.4.0", | ||
@@ -32,0 +32,0 @@ "@types/jest": "^24.0.18", |
import { Agent } from './agent'; | ||
import { CanisterId } from './canisterId'; | ||
import * as IDL from './idl'; | ||
import { Principal } from './principal'; | ||
import { BinaryBlob } from './types'; | ||
@@ -17,3 +17,3 @@ /** | ||
export interface ActorConfig extends CallConfig { | ||
canisterId: string | CanisterId; | ||
canisterId: string | Principal; | ||
} | ||
@@ -35,6 +35,6 @@ /** | ||
* some fields marked as required (as they are defaulted) and canisterId as | ||
* a CanisterId type. | ||
* a Principal type. | ||
*/ | ||
interface ActorMetadata { | ||
canisterId: CanisterId; | ||
canisterId: Principal; | ||
service: IDL.ServiceClass; | ||
@@ -56,3 +56,3 @@ agent?: Agent; | ||
static interfaceOf(actor: Actor): IDL.ServiceClass; | ||
static canisterIdOf(actor: Actor): CanisterId; | ||
static canisterIdOf(actor: Actor): Principal; | ||
static install(fields: { | ||
@@ -65,3 +65,3 @@ module: BinaryBlob; | ||
}, config: ActorConfig): Promise<void>; | ||
static createCanister(config?: CallConfig): Promise<CanisterId>; | ||
static createCanister(config?: CallConfig): Promise<Principal>; | ||
static createAndInstallCanister(interfaceFactory: IDL.InterfaceFactory, fields: { | ||
@@ -68,0 +68,0 @@ module: BinaryBlob; |
@@ -11,6 +11,6 @@ "use strict"; | ||
const buffer_1 = require("buffer/"); | ||
const canisterId_1 = require("./canisterId"); | ||
const management_1 = require("./canisters/management"); | ||
const http_agent_types_1 = require("./http_agent_types"); | ||
const IDL = __importStar(require("./idl")); | ||
const principal_1 = require("./principal"); | ||
const request_id_1 = require("./request_id"); | ||
@@ -65,3 +65,3 @@ function getDefaultAgent() { | ||
const canisterId = typeof config.canisterId === 'string' | ||
? canisterId_1.CanisterId.fromText(config.canisterId) | ||
? principal_1.Principal.fromText(config.canisterId) | ||
: config.canisterId; | ||
@@ -93,3 +93,3 @@ const computerAllocation = fields.computerAllocation !== undefined ? [fields.computerAllocation] : []; | ||
const canisterId = typeof config.canisterId === 'string' | ||
? canisterId_1.CanisterId.fromText(config.canisterId) | ||
? principal_1.Principal.fromText(config.canisterId) | ||
: config.canisterId; | ||
@@ -96,0 +96,0 @@ super(Object.assign(Object.assign(Object.assign({}, DEFAULT_ACTOR_CONFIG), config), { canisterId, |
import { ActorFactory } from '../actor'; | ||
import { CanisterId } from '../canisterId'; | ||
import { QueryFields, QueryResponse, RequestStatusFields, RequestStatusResponse, SubmitResponse } from '../http_agent_types'; | ||
@@ -9,3 +8,3 @@ import * as IDL from '../idl'; | ||
requestStatus(fields: RequestStatusFields, principal?: Principal): Promise<RequestStatusResponse>; | ||
call(canisterId: CanisterId | string, fields: { | ||
call(canisterId: Principal | string, fields: { | ||
methodName: string; | ||
@@ -16,8 +15,8 @@ arg: BinaryBlob; | ||
status(): Promise<JsonObject>; | ||
install(canisterId: CanisterId | string, fields: { | ||
install(canisterId: Principal | string, fields: { | ||
module: BinaryBlob; | ||
arg?: BinaryBlob; | ||
}, principal?: Principal): Promise<SubmitResponse>; | ||
query(canisterId: CanisterId | string, fields: QueryFields, principal?: Principal): Promise<QueryResponse>; | ||
query(canisterId: Principal | string, fields: QueryFields, principal?: Principal): Promise<QueryResponse>; | ||
makeActorFactory(actorInterfaceFactory: IDL.InterfaceFactory): ActorFactory; | ||
} |
import { ActorFactory } from '../actor'; | ||
import { Agent } from '../agent'; | ||
import { CanisterId } from '../canisterId'; | ||
import { AuthHttpAgentRequestTransformFn, HttpAgentRequest, HttpAgentRequestTransformFn, QueryFields, QueryResponse, ReadRequest, ReadResponse, RequestStatusFields, RequestStatusResponse, SignedHttpAgentRequest, SubmitRequest, SubmitResponse } from '../http_agent_types'; | ||
@@ -28,7 +27,7 @@ import * as IDL from '../idl'; | ||
setAuthTransform(fn: AuthHttpAgentRequestTransformFn): void; | ||
call(canisterId: CanisterId | string, fields: { | ||
call(canisterId: Principal | string, fields: { | ||
methodName: string; | ||
arg: BinaryBlob; | ||
}, principal?: Principal | Promise<Principal>): Promise<SubmitResponse>; | ||
install(canisterId: CanisterId | string, fields: { | ||
install(canisterId: Principal | string, fields: { | ||
module: BinaryBlob; | ||
@@ -38,3 +37,3 @@ arg?: BinaryBlob; | ||
createCanister(principal?: Principal): Promise<SubmitResponse>; | ||
query(canisterId: CanisterId | string, fields: QueryFields, principal?: Principal): Promise<QueryResponse>; | ||
query(canisterId: Principal | string, fields: QueryFields, principal?: Principal): Promise<QueryResponse>; | ||
requestStatus(fields: RequestStatusFields, principal?: Principal): Promise<RequestStatusResponse>; | ||
@@ -41,0 +40,0 @@ status(): Promise<JsonObject>; |
@@ -12,5 +12,5 @@ "use strict"; | ||
const actor = __importStar(require("../actor")); | ||
const canisterId_1 = require("../canisterId"); | ||
const cbor = __importStar(require("../cbor")); | ||
const http_agent_types_1 = require("../http_agent_types"); | ||
const principal_1 = require("../principal"); | ||
const request_id_1 = require("../request_id"); | ||
@@ -92,3 +92,3 @@ const types_1 = require("../types"); | ||
request_type: http_agent_types_1.SubmitRequestType.Call, | ||
canister_id: typeof canisterId === 'string' ? canisterId_1.CanisterId.fromText(canisterId) : canisterId, | ||
canister_id: typeof canisterId === 'string' ? principal_1.Principal.fromText(canisterId) : canisterId, | ||
method_name: fields.methodName, | ||
@@ -107,3 +107,3 @@ arg: fields.arg, | ||
request_type: http_agent_types_1.SubmitRequestType.InstallCode, | ||
canister_id: typeof canisterId === 'string' ? canisterId_1.CanisterId.fromText(canisterId) : canisterId, | ||
canister_id: typeof canisterId === 'string' ? principal_1.Principal.fromText(canisterId) : canisterId, | ||
module: fields.module, | ||
@@ -133,3 +133,3 @@ arg: fields.arg || types_1.blobFromHex(''), | ||
request_type: "query" /* Query */, | ||
canister_id: typeof canisterId === 'string' ? canisterId_1.CanisterId.fromText(canisterId) : canisterId, | ||
canister_id: typeof canisterId === 'string' ? principal_1.Principal.fromText(canisterId) : canisterId, | ||
method_name: fields.methodName, | ||
@@ -136,0 +136,0 @@ arg: fields.arg, |
@@ -1,2 +0,2 @@ | ||
import { ActorFactory, BinaryBlob, CallFields, CanisterId, JsonObject, Principal, QueryFields, QueryResponse, RequestStatusFields, RequestStatusResponse, SubmitResponse } from '@dfinity/agent'; | ||
import { ActorFactory, BinaryBlob, CallFields, JsonObject, Principal, QueryFields, QueryResponse, RequestStatusFields, RequestStatusResponse, SubmitResponse } from '@dfinity/agent'; | ||
import * as IDL from '../idl'; | ||
@@ -68,12 +68,12 @@ import { Agent } from './api'; | ||
requestStatus(fields: RequestStatusFields, principal?: Principal): Promise<RequestStatusResponse>; | ||
call(canisterId: CanisterId | string, fields: CallFields, principal?: Principal): Promise<SubmitResponse>; | ||
call(canisterId: Principal | string, fields: CallFields, principal?: Principal): Promise<SubmitResponse>; | ||
createCanister(principal?: Principal): Promise<SubmitResponse>; | ||
status(): Promise<JsonObject>; | ||
install(canisterId: CanisterId | string, fields: { | ||
install(canisterId: Principal | string, fields: { | ||
module: BinaryBlob; | ||
arg?: BinaryBlob; | ||
}, principal?: Principal): Promise<SubmitResponse>; | ||
query(canisterId: CanisterId | string, fields: QueryFields, principal?: Principal): Promise<QueryResponse>; | ||
query(canisterId: Principal | string, fields: QueryFields, principal?: Principal): Promise<QueryResponse>; | ||
makeActorFactory(actorInterfaceFactory: IDL.InterfaceFactory): ActorFactory; | ||
private _sendAndWait; | ||
} |
@@ -24,4 +24,6 @@ "use strict"; | ||
const request_id_1 = require("./request_id"); | ||
const domainSeparator = buffer_1.Buffer.from('\x0Aic-request'); | ||
function sign(requestId, secretKey) { | ||
const signature = tweetnacl.sign.detached(requestId, secretKey); | ||
const bufA = buffer_1.Buffer.concat([domainSeparator, requestId]); | ||
const signature = tweetnacl.sign.detached(bufA, secretKey); | ||
return buffer_1.Buffer.from(signature); | ||
@@ -31,3 +33,4 @@ } | ||
function verify(requestId, senderSig, senderPubKey) { | ||
return tweetnacl.sign.detached.verify(requestId, senderSig, senderPubKey); | ||
const bufA = buffer_1.Buffer.concat([domainSeparator, requestId]); | ||
return tweetnacl.sign.detached.verify(bufA, senderSig, senderPubKey); | ||
} | ||
@@ -34,0 +37,0 @@ exports.verify = verify; |
@@ -14,4 +14,4 @@ "use strict"; | ||
const bignumber_js_1 = __importDefault(require("bignumber.js")); | ||
const canisterId_1 = require("../canisterId"); | ||
const IDL = __importStar(require("../idl")); | ||
const principal_1 = require("../principal"); | ||
const UI = __importStar(require("./candid-core")); | ||
@@ -128,10 +128,10 @@ const InputConfig = { parse: parsePrimitive }; | ||
visitPrincipal(t, v) { | ||
return canisterId_1.CanisterId.fromText(v); | ||
return principal_1.Principal.fromText(v); | ||
} | ||
visitService(t, v) { | ||
return canisterId_1.CanisterId.fromText(v); | ||
return principal_1.Principal.fromText(v); | ||
} | ||
visitFunc(t, v) { | ||
const x = v.split('.', 2); | ||
return [canisterId_1.CanisterId.fromText(x[0]), x[1]]; | ||
return [principal_1.Principal.fromText(x[0]), x[1]]; | ||
} | ||
@@ -138,0 +138,0 @@ } |
@@ -1,6 +0,6 @@ | ||
import { ActorSubclass, CallConfig } from '../actor'; | ||
import { CanisterId } from '../canisterId'; | ||
import { CallConfig } from '../actor'; | ||
import { Principal } from '../principal'; | ||
export interface ManagementCanisterRecord { | ||
create_canister(): Promise<{ | ||
canister_id: CanisterId; | ||
canister_id: Principal; | ||
}>; | ||
@@ -15,3 +15,3 @@ install_code(arg0: { | ||
}; | ||
canister_id: CanisterId; | ||
canister_id: Principal; | ||
wasm_module: number[]; | ||
@@ -27,2 +27,2 @@ arg: number[]; | ||
*/ | ||
export declare function getManagementCanister(config: CallConfig): ActorSubclass<ManagementCanisterRecord>; | ||
export declare function getManagementCanister(config: CallConfig): import("../actor").ActorSubclass<ManagementCanisterRecord>; |
@@ -7,3 +7,3 @@ "use strict"; | ||
const actor_1 = require("../actor"); | ||
const canisterId_1 = require("../canisterId"); | ||
const principal_1 = require("../principal"); | ||
const management_idl_1 = __importDefault(require("./management_idl")); | ||
@@ -16,5 +16,5 @@ /* tslint:enable */ | ||
function getManagementCanister(config) { | ||
return actor_1.Actor.createActor(management_idl_1.default, Object.assign(Object.assign({}, config), { canisterId: canisterId_1.CanisterId.fromHex('') })); | ||
return actor_1.Actor.createActor(management_idl_1.default, Object.assign(Object.assign({}, config), { canisterId: principal_1.Principal.fromHex('') })); | ||
} | ||
exports.getManagementCanister = getManagementCanister; | ||
//# sourceMappingURL=management.js.map |
@@ -21,3 +21,3 @@ "use strict"; | ||
const simple_cbor_1 = require("simple-cbor"); | ||
const canisterId_1 = require("./canisterId"); | ||
const principal_1 = require("./principal"); | ||
// We are using hansl/simple-cbor for CBOR serialization, to avoid issues with | ||
@@ -31,3 +31,3 @@ // encoding the uint64 values that the HTTP handler of the client expects for | ||
get name() { | ||
return 'CanisterId'; | ||
return 'Principal'; | ||
} | ||
@@ -44,16 +44,2 @@ get priority() { | ||
} | ||
class CanisterIdEncoder { | ||
get name() { | ||
return 'CanisterId'; | ||
} | ||
get priority() { | ||
return 0; | ||
} | ||
match(value) { | ||
return value && value._isCanisterId === true; | ||
} | ||
encode(v) { | ||
return cbor.value.bytes(v.toBlob()); | ||
} | ||
} | ||
class BufferEncoder { | ||
@@ -75,3 +61,2 @@ get name() { | ||
serializer.addEncoder(new PrincipalEncoder()); | ||
serializer.addEncoder(new CanisterIdEncoder()); | ||
serializer.addEncoder(new BufferEncoder()); | ||
@@ -95,3 +80,3 @@ var CborTag; | ||
if (result.hasOwnProperty('canister_id')) { | ||
result.canister_id = canisterId_1.CanisterId.fromText(result.canister_id.toString(16)); | ||
result.canister_id = principal_1.Principal.fromText(result.canister_id.toString(16)); | ||
} | ||
@@ -98,0 +83,0 @@ return result; |
@@ -1,2 +0,2 @@ | ||
import { CanisterId } from './canisterId'; | ||
import { Principal } from './principal'; | ||
import { RejectCode } from './reject_code'; | ||
@@ -55,3 +55,3 @@ import { RequestId } from './request_id'; | ||
request_type: SubmitRequestType.Call; | ||
canister_id: CanisterId; | ||
canister_id: Principal; | ||
method_name: string; | ||
@@ -63,3 +63,3 @@ arg: BinaryBlob; | ||
request_type: SubmitRequestType.InstallCode; | ||
canister_id: CanisterId; | ||
canister_id: Principal; | ||
module: BinaryBlob; | ||
@@ -112,3 +112,3 @@ arg?: BinaryBlob; | ||
request_type: ReadRequestType.Query; | ||
canister_id: CanisterId; | ||
canister_id: Principal; | ||
method_name: string; | ||
@@ -115,0 +115,0 @@ arg: BinaryBlob; |
import BigNumber from 'bignumber.js'; | ||
import Pipe = require('buffer-pipe'); | ||
import { Buffer } from 'buffer/'; | ||
import { CanisterId } from './canisterId'; | ||
import { Principal as PrincipalId } from './principal'; | ||
import { JsonValue } from './types'; | ||
@@ -296,10 +296,10 @@ /** | ||
*/ | ||
export declare class PrincipalClass extends PrimitiveType<CanisterId> { | ||
export declare class PrincipalClass extends PrimitiveType<PrincipalId> { | ||
accept<D, R>(v: Visitor<D, R>, d: D): R; | ||
covariant(x: any): x is CanisterId; | ||
encodeValue(x: CanisterId): Buffer; | ||
covariant(x: any): x is PrincipalId; | ||
encodeValue(x: PrincipalId): Buffer; | ||
encodeType(): Buffer; | ||
decodeValue(b: Pipe, t: Type): CanisterId; | ||
decodeValue(b: Pipe, t: Type): PrincipalId; | ||
get name(): string; | ||
valueToString(x: CanisterId): string; | ||
valueToString(x: PrincipalId): string; | ||
} | ||
@@ -312,3 +312,3 @@ /** | ||
*/ | ||
export declare class FuncClass extends ConstructType<[CanisterId, string]> { | ||
export declare class FuncClass extends ConstructType<[PrincipalId, string]> { | ||
argTypes: Type[]; | ||
@@ -320,21 +320,21 @@ retTypes: Type[]; | ||
accept<D, R>(v: Visitor<D, R>, d: D): R; | ||
covariant(x: any): x is [CanisterId, string]; | ||
encodeValue(x: [CanisterId, string]): Buffer; | ||
covariant(x: any): x is [PrincipalId, string]; | ||
encodeValue(x: [PrincipalId, string]): Buffer; | ||
_buildTypeTableImpl(T: TypeTable): void; | ||
decodeValue(b: Pipe): [CanisterId, string]; | ||
decodeValue(b: Pipe): [PrincipalId, string]; | ||
get name(): string; | ||
valueToString(x: [CanisterId, string]): string; | ||
valueToString([principal, str]: [PrincipalId, string]): string; | ||
display(): string; | ||
private encodeAnnotation; | ||
} | ||
export declare class ServiceClass extends ConstructType<CanisterId> { | ||
export declare class ServiceClass extends ConstructType<PrincipalId> { | ||
readonly _fields: Array<[string, FuncClass]>; | ||
constructor(fields: Record<string, FuncClass>); | ||
accept<D, R>(v: Visitor<D, R>, d: D): R; | ||
covariant(x: any): x is CanisterId; | ||
encodeValue(x: CanisterId): Buffer; | ||
covariant(x: any): x is PrincipalId; | ||
encodeValue(x: PrincipalId): Buffer; | ||
_buildTypeTableImpl(T: TypeTable): void; | ||
decodeValue(b: Pipe): CanisterId; | ||
decodeValue(b: Pipe): PrincipalId; | ||
get name(): string; | ||
valueToString(x: CanisterId): string; | ||
valueToString(x: PrincipalId): string; | ||
} | ||
@@ -341,0 +341,0 @@ /** |
@@ -10,3 +10,3 @@ "use strict"; | ||
const buffer_1 = require("buffer/"); | ||
const canisterId_1 = require("./canisterId"); | ||
const principal_1 = require("./principal"); | ||
const hash_1 = require("./utils/hash"); | ||
@@ -885,3 +885,3 @@ const leb128_1 = require("./utils/leb128"); | ||
const hex = b.read(len).toString('hex').toUpperCase(); | ||
return canisterId_1.CanisterId.fromHex(hex); | ||
return principal_1.Principal.fromHex(hex); | ||
} | ||
@@ -896,3 +896,3 @@ /** | ||
covariant(x) { | ||
return x && x._isCanisterId; | ||
return x && x._isPrincipal; | ||
} | ||
@@ -916,3 +916,3 @@ encodeValue(x) { | ||
valueToString(x) { | ||
return x.toText(); | ||
return `${this.name} "${x.toText()}"`; | ||
} | ||
@@ -944,3 +944,3 @@ } | ||
covariant(x) { | ||
return (Array.isArray(x) && x.length === 2 && x[0] && x[0]._isCanisterId && typeof x[1] === 'string'); | ||
return (Array.isArray(x) && x.length === 2 && x[0] && x[0]._isPrincipal && typeof x[1] === 'string'); | ||
} | ||
@@ -984,4 +984,4 @@ encodeValue(x) { | ||
} | ||
valueToString(x) { | ||
return x[0].toText() + '.' + x[1]; | ||
valueToString([principal, str]) { | ||
return `func "${principal.toText()}".${str}`; | ||
} | ||
@@ -1016,3 +1016,3 @@ display() { | ||
covariant(x) { | ||
return x && x._isCanisterId; | ||
return x && x._isPrincipal; | ||
} | ||
@@ -1044,3 +1044,3 @@ encodeValue(x) { | ||
valueToString(x) { | ||
return x.toText(); | ||
return `service "${x.toText()}"`; | ||
} | ||
@@ -1047,0 +1047,0 @@ } |
export * from './actor'; | ||
export * from './agent'; | ||
export { KeyPair, SenderPubKey, SenderSecretKey, SenderSig, generateKeyPair, makeAuthTransform, makeKeyPair, } from './auth'; | ||
export * from './canisterId'; | ||
export * from './http_agent_transforms'; | ||
@@ -6,0 +5,0 @@ export * from './http_agent_types'; |
@@ -19,3 +19,2 @@ "use strict"; | ||
exports.makeKeyPair = auth_1.makeKeyPair; | ||
__export(require("./canisterId")); | ||
__export(require("./http_agent_transforms")); | ||
@@ -22,0 +21,0 @@ __export(require("./http_agent_types")); |
@@ -5,6 +5,13 @@ import { SenderPubKey } from './auth'; | ||
private _blob; | ||
static selfAuthenticating(publicKey: SenderPubKey): Promise<Principal>; | ||
static selfAuthenticating(publicKey: SenderPubKey): Principal; | ||
static fromHex(hex: string): Principal; | ||
static fromText(text: string): Principal; | ||
static fromBlob(blob: BinaryBlob): Principal; | ||
readonly _isPrincipal = true; | ||
protected constructor(_blob: BinaryBlob); | ||
toBlob(): BinaryBlob; | ||
toHash(): BinaryBlob; | ||
toHex(): string; | ||
toText(): string; | ||
toString(): string; | ||
} |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const base32_js_1 = __importDefault(require("base32.js")); | ||
const types_1 = require("./types"); | ||
const sha256_1 = require("./utils/sha256"); | ||
const getCrc_1 = require("./utils/getCrc"); | ||
const sha224_1 = require("./utils/sha224"); | ||
const SELF_AUTHENTICATING_SUFFIX = 2; | ||
@@ -11,11 +16,46 @@ class Principal { | ||
} | ||
static async selfAuthenticating(publicKey) { | ||
const sha = await sha256_1.sha256(publicKey); | ||
return new Principal(types_1.blobFromUint8Array(new Uint8Array([...sha, 2]))); | ||
static selfAuthenticating(publicKey) { | ||
const sha = sha224_1.sha224(publicKey); | ||
return new this(types_1.blobFromUint8Array(new Uint8Array([...sha, 2]))); | ||
} | ||
static fromHex(hex) { | ||
return new this(types_1.blobFromHex(hex)); | ||
} | ||
static fromText(text) { | ||
const canisterIdNoDash = text.toLowerCase().replace(/-/g, ''); | ||
const decoder = new base32_js_1.default.Decoder({ type: 'rfc4648', lc: false }); | ||
const result = decoder.write(canisterIdNoDash).finalize(); | ||
let arr = new Uint8Array(result); | ||
arr = arr.slice(4, arr.length); | ||
return new this(types_1.blobFromUint8Array(arr)); | ||
} | ||
static fromBlob(blob) { | ||
return new this(blob); | ||
} | ||
toBlob() { | ||
return this._blob; | ||
} | ||
toHash() { | ||
return this._blob; | ||
} | ||
toHex() { | ||
return types_1.blobToHex(this._blob).toUpperCase(); | ||
} | ||
toText() { | ||
const checksumArrayBuf = new ArrayBuffer(4); | ||
const view = new DataView(checksumArrayBuf); | ||
view.setUint32(0, getCrc_1.getCrc32(this.toHex().toLowerCase()), false); | ||
const checksum = Uint8Array.from(Buffer.from(checksumArrayBuf)); | ||
const bytes = Uint8Array.from(this._blob); | ||
const array = new Uint8Array([...checksum, ...bytes]); | ||
const encoder = new base32_js_1.default.Encoder({ type: 'rfc4648', lc: false }); | ||
const result = encoder.write(array).finalize().toLowerCase(); | ||
const matches = result.match(/.{1,5}/g); | ||
return matches ? matches.join('-') : ''; | ||
} | ||
toString() { | ||
return this.toText(); | ||
} | ||
} | ||
exports.Principal = Principal; | ||
//# sourceMappingURL=principal.js.map |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
145712
12
57
9
4163
2
+ Addedbase32.js@^0.1.0
+ Addedjs-sha256@0.9.0
+ Addedbase32.js@0.1.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedjs-sha256@0.9.0(transitive)
- Removedbase64-js@1.3.1
- Removedbase64-js@1.3.1(transitive)