@waku/rln
Version:
RLN (Rate Limiting Nullifier) implementation for Waku
20 lines (17 loc) • 486 B
JavaScript
import { toUtf8Bytes, toUtf8String } from '../../../strings/lib.esm/utf8.js';
import { DynamicBytesCoder } from './bytes.js';
class StringCoder extends DynamicBytesCoder {
constructor(localName) {
super("string", localName);
}
defaultValue() {
return "";
}
encode(writer, value) {
return super.encode(writer, toUtf8Bytes(value));
}
decode(reader) {
return toUtf8String(super.decode(reader));
}
}
export { StringCoder };