import { Connector } from '../../connectors/Connector' ; import { Permission } from '../Types' ; /**
 * The Auth method group is used to manage the authorization tokens.
 */ export class JsonRpcAuthMethodGroup { private conn : Connector ; constructor ( conn ) { this . conn = conn ; } param token public async verify ( token ) { const permissions = await this . conn . request ( { method : 'Filecoin.AuthVerify' , params : [ token ] } ) ; return permissions ; } param permissions public async new ( permissions ) { const token = await this . conn . request ( { method : 'Filecoin.AuthNew' , params : [ permissions ] } ) ; const tokenAscii = Buffer . from ( token , 'base64' ) . toString ( 'ascii' ) ; return tokenAscii ; } }