Skip to content

Commit

Permalink
fix(internal): allow serialization of principals to their text values (
Browse files Browse the repository at this point in the history
…#901)

This is a non-user visible change.
  • Loading branch information
Hans committed Aug 5, 2020
1 parent e6f300a commit e72c69e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/agent/javascript/src/principal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ export class Principal {
const matches = result.match(/.{1,5}/g);
return matches ? matches.join('-') : '';
}

public toString() {
return this.toText();
}
}
23 changes: 23 additions & 0 deletions src/bootstrap/types/base32.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
declare module 'base32.js' {
type Ret = {
finalize: () => any;
};

interface DecoderConfig {
type?: 'rfc4648' | 'crockford' | 'base32hex';
alphabet?: string;
lc?: boolean;
}
class Decoder {
constructor(options?: DecoderConfig);
write(str: string): this;
finalize(str?: string): ArrayBuffer;
}
class Encoder {
private buf: ArrayBuffer;
private charmap: { [key: number]: number };
constructor(options?: DecoderConfig);
write(buf: ArrayBuffer): this;
finalize(str?: ArrayBuffer): string;
}
}

0 comments on commit e72c69e

Please sign in to comment.