Skip to content

Commit e72c69e

Browse files
author
Hans
authored
fix(internal): allow serialization of principals to their text values (#901)
This is a non-user visible change.
1 parent e6f300a commit e72c69e

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/agent/javascript/src/principal.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,8 @@ export class Principal {
6161
const matches = result.match(/.{1,5}/g);
6262
return matches ? matches.join('-') : '';
6363
}
64+
65+
public toString() {
66+
return this.toText();
67+
}
6468
}

src/bootstrap/types/base32.d.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
declare module 'base32.js' {
2+
type Ret = {
3+
finalize: () => any;
4+
};
5+
6+
interface DecoderConfig {
7+
type?: 'rfc4648' | 'crockford' | 'base32hex';
8+
alphabet?: string;
9+
lc?: boolean;
10+
}
11+
class Decoder {
12+
constructor(options?: DecoderConfig);
13+
write(str: string): this;
14+
finalize(str?: string): ArrayBuffer;
15+
}
16+
class Encoder {
17+
private buf: ArrayBuffer;
18+
private charmap: { [key: number]: number };
19+
constructor(options?: DecoderConfig);
20+
write(buf: ArrayBuffer): this;
21+
finalize(str?: ArrayBuffer): string;
22+
}
23+
}

0 commit comments

Comments
 (0)