diff --git a/examples/deno/mod.ts b/examples/deno/mod.ts index 84b46e8..d138b39 100644 --- a/examples/deno/mod.ts +++ b/examples/deno/mod.ts @@ -1,4 +1,4 @@ -import { init, wasm_data, totp, hotp } from 'totp-wasm' +import { init, wasm_data, totp, hotp, steam_guard } from 'totp-wasm' import { assertEquals, base64Decode } from './deps.ts' await init(base64Decode(wasm_data)) @@ -25,3 +25,13 @@ Deno.test({ assertEquals(code, 473526) }, }) + +Deno.test({ + name: 'Steam Guard test', + fn() { + const secret = 'GM4VC2CQN5UGS33ZJJVWYUSFMQ4HOQJW' + const t = BigInt(1662681600) + const code = steam_guard(secret, t) + assertEquals(code, '4PRPM') + }, +}) diff --git a/examples/node/index.ts b/examples/node/index.ts index 3d79c96..63e1b93 100644 --- a/examples/node/index.ts +++ b/examples/node/index.ts @@ -1,4 +1,4 @@ -import { init, totp, hotp } from '../../packages/totp-wasm/index' +import { init, totp, hotp, steam_guard } from '../../packages/totp-wasm/index' import { wasm_data } from '../../packages/totp-wasm/dist/wasm_data' test() @@ -21,4 +21,10 @@ async function test() { const code = totp(secret, t, digit, period) console.log(code === 473526) } + { + const secret = 'GM4VC2CQN5UGS33ZJJVWYUSFMQ4HOQJW' + const t = BigInt(1662681600) + const code = steam_guard(secret, t) + console.log(code === '4PRPM') + } } diff --git a/packages/totp-wasm/dist/totp-wasm.wasm b/packages/totp-wasm/dist/totp-wasm.wasm index 39a8896..f504386 100644 Binary files a/packages/totp-wasm/dist/totp-wasm.wasm and b/packages/totp-wasm/dist/totp-wasm.wasm differ diff --git a/packages/totp-wasm/dist/wasm_data.js b/packages/totp-wasm/dist/wasm_data.js index 4d5ac6c..d62f2c6 100644 --- a/packages/totp-wasm/dist/wasm_data.js +++ b/packages/totp-wasm/dist/wasm_data.js @@ -1,2 +1,2 @@ // @ts-nocheck wasmdata -export const wasm_data = "AGFzbQEAAAABWw1gA39/fwBgBH9/f38Bf2AFf39/f38AYAJ/fwF/YAZ/f39/f38Bf2ACf38AYAF/AGABfwF/YAR/f35/AX9gBH9/f38AYAN/f38Bf2AFf39+f38Bf2ADf39+AX8CDwEDZW52Bm1lbW9yeQIAEQMnJggICQYAAAMDAQADBgMBAAALAAUMBwAGAgoJBQABBAIBBwcEBQUKBAUBcAEHBwYJAX8BQYCAwAALBy0FBGhvdHAAAAR0b3RwABALc3RlYW1fZ3VhcmQAEwZtYWxsb2MAFARmcmVlABYJDAEAQQELBhwdHh8iFwq1TSYMACAAIAEgAiADEAELuAIBBX8jAEEgayIEJAAgBCACQjiGIAJCgP4Dg0IohoQgAkKAgPwHg0IYhiACQoCAgPgPg0IIhoSEIAJCCIhCgICA+A+DIAJCGIhCgID8B4OEIAJCKIhCgP4DgyACQjiIhISENwAYIARBBGoiBSAEQRhqIAAgARACIAQtABdBD3EgBWoiAC0AACEFIAAtAAEhBiAALQACIQcgAC0AAyEIAkAgAwR/IANBH0sNAUEKIQFBASEAA0AgA0ECTwRAIANBAXEEQCAArSABrX4iAkIgiKcNBCACpyEACyABrSICIAJ+IgJCIIinDQMgAqchASADQQF2IQMMAQsLIACtIAGtfiICQiCIpw0BIAKnBUEBCyEDIARBIGokACAFQRh0QYCAgPgHcSAHQQh0IAhyIAZBEHRyciADcA8LAAveAgECfyMAQcADayIEJAACQCADQcEATwRAIARBoAFqIgVB8IDAAEHgABAlGiAFIAIgAxARIAUgBEHAAmoQEiAEQdQCakEsECQMAQsgA0HAAEcEQCAEQcACaiIFIAIgAxAlGiADIAVqQcAAIANrECQMAQsgBEHAAmogAkHAABAlGgtBACEDA0AgA0HAAEYEQEEAIQMDQCADQcAARkUEQCAEQYADaiADaiAEQcACaiADai0AAEE2czoAACADQQFqIQMMAQsLIARBoAFqIgJB8IDAAEHgABAlGiACIARBgANqQcAAEBEgBCACQaABECUiAiABQQgQESACIAJBgANqIgMQEiACQaABaiIBQfCAwABB4AAQJRogASACQeAAakHAABARIAEgA0EUEBEgASAAEBIgAkHAA2okAAUgAyAEakGAAmogBEHAAmogA2otAABB3ABzOg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c2ogAUEFd2pBqvz0rANrNgIICyEAIAEEQANAIABBADoAACAAQQFqIQAgAUEBayIBDQALCwtDAQF/AkAgAkUNACACQQFrIQIgACEDA0AgAyABLQAAOgAAIAJFDQEgAkEBayECIAFBAWohASADQQFqIQMMAAsACyAACwuTAQUAQYCAwAALQUFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaMjM0NTY3AAAAAAEAAAACAAAAAwAAAAAAAAAkABAABAAAAAUAAAAGAEHMgMAACxA4ABAA2AAQABAAAAD/////AEHsgMAACwEBAEH4gMAACxQBI0VniavN7/7cuph2VDIQ8OHSwwBB0IHAAAsEqqqqqg=="; \ No newline at end of file +export const wasm_data = "AGFzbQEAAAABWw1gA39/fwBgBH9/f38Bf2AFf39/f38AYAJ/fwF/YAZ/f39/f38Bf2ACf38AYAF/AGABfwF/YAR/f35/AX9gBH9/f38AYAN/f38Bf2AFf39+f38Bf2ADf39+AX8CDwEDZW52Bm1lbW9yeQIAEQMmJQgICQYAAAMDAQADBgMBAAALAAUMBwYCCgkFAAEEAgEHBwQFBQoEBQFwAQcHBgkBfwFBgIDAAAsHLQUEaG90cAAABHRvdHAAEAtzdGVhbV9ndWFyZAATBm1hbGxvYwAUBGZyZWUAFQkMAQBBAQsGGxwdHiEWCv1OJQwAIAAgASACIAMQAQu4AgEFfyMAQSBrIgQkACAEIAJCOIYgAkKA/gODQiiGhCACQoCA/AeDQhiGIAJCgICA+A+DQgiGhIQgAkIIiEKAgID4D4MgAkIYiEKAgPwHg4QgAkIoiEKA/gODIAJCOIiEhIQ3ABggBEEEaiIFIARBGGogACABEAIgBC0AF0EPcSAFaiIALQAAIQUgAC0AASEGIAAtAAIhByAALQADIQgCQCADBH8gA0EfSw0BQQohAUEBIQADQCADQQJPBEAgA0EBcQRAIACtIAGtfiICQiCIpw0EIAKnIQALIAGtIgIgAn4iAkIgiKcNAyACpyEBIANBAXYhAwwBCwsgAK0gAa1+IgJCIIinDQEgAqcFQQELIQMgBEEgaiQAIAVBGHRBgICA+AdxIAdBCHQgCHIgBkEQdHJyIANwDwsAC94CAQJ/IwBBwANrIgQkAAJAIANBwQBPBEAgBEGgAWoiBUGIgcAAQeAAECQaIAUgAiADEBEgBSAEQcACahASIARB1AJqQSwQIwwBCyADQcAARwRAIARBwAJqIgUgAiADECQaIAMgBWpBwAAgA2sQIwwBCyAEQcACaiACQcAAECQaC0EAIQMDQCADQcAARgRAQQAhAwNAIANBwABGRQRAIARBgANqIANqIARBwAJqIANqLQAAQTZzOgAAIANBAWohAwwBCwsgBEGgAWoiAkGIgcAAQeAAECQaIAIgBEGAA2pBwAAQESAEIAJBoAEQJCICIAFBCBARIAIgAkGAA2oiAxASIAJBoAFqIgFBiIHAAEHgABAkGiABIAJB4ABqQcAAEBEgASADQRQQESABIAAQEiACQcADaiQABSADIARqQYACaiAEQcACaiADai0AAEHcAHM6AAAgA0EBaiEDDAELCwsvAQF/IwBBEGsiASQAIAEgACkCDDcDCCABQQhqIAAoAgAgACgCCBAEIAFBEGokAAswAQF/IAJBA3RBACACGyIDBEAgACgCACABQQQgAhsgA0ECQQAgACgCBCgCCBECAAsLxAsCCX8BfiMAQaABayIDJAAgASACakEBayEIQQBBBiACIAJBBk8bIgVrIQYgAiAFayEJAkADQCAEIAZGDQEgBCAIai0AAEE9RgRAIARBAWshBAwBCwsgAiAEaiEJCyADQQA2AoABIANCqtWq1Qo3A3ggA0HIgMAAKQIANwKEAQJAIANB+ABqIAlBBWxBA3YiC0EEaiIEIARBBXBrEAYiBEH//wNxBEAgACAEOwEIDAELIANBEGogA0GIAWoiCCgCADYCACADQQhqIANBgAFqIgYpAwA3AwAgAyADKQN4NwMAIANBADYCgAEgA0Kq1arVCjcDeCADQciAwAApAgA3AoQBAkAgA0H4AGogAkEHakEDdiIFEAciBEH//wNxDQAgA0HwAGogCCgCADYCACADQegAaiAGKQMANwMAIAMgAykDeDcDYEEAIQkCQANAAkAgBSAJRg0AIAIgCUEDdCIISQ0AIAMoAmgiBCADKAJkIgp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QRBqJAALOQECfyABIAAoAggiAksEfwNAQX8gAkEBdiACakEIaiIDIAIgA0sbIgIgAUkNAAsgACACEAYFIAMLC1wBAX8jAEEQayIEJAACfyADRQRAIAQgACkCADcDCCAEQQhqIAEgAhAPQQEMAQtBACACRQ0AGiAAKAIAIAEgAkEAIANBACAAKAIEKAIEEQQACyEDIARBEGokACADC50BAQF/IwBBEGsiAyQAIAMgASkCADcDCCADQQhqIQECQCACRQRAIABBCGpB9IDAACgCADYCACAAQeyAwAApAgA3AgAMAQsgASgCACACQQBBACABKAIEKAIAEQEAIgFFBEAgAEEIakGAgcAAKAIANgIAIABB+IDAACkCADcCAAwBCyAAQQA7AQggACACNgIEIAAgATYCAAsgA0EQaiQACygAIAIEQCAAKAIAIAFBqtWq1XogAhsgAkEAQQAgACgCBCgCCBECAAsLZwICfwJ+IwBBEGsiBSQAIAUgACABEAVBACEBIAUvAQhFBEAgBSgCACIAIAUoAgQiBiACQj+HQgAgAiACIAStIgd/IgggB35SGyAIfCADEAEhAUHIgMAAIAAgBhAPCyAFQRBqJAAgAQuXAQEDfyAALQBcIgRFIAIgBGpBwABJckUEQCAAQRxqIgUgBGogAUHAACAEa0H/AXEiAxAkGiAAIAUQIiAAQQA6AFwLA0AgA0FAayIFIAJLRQRAIAAgASADahAiIAUhAwwBCwsgACAALQBcakEcaiABIANqIAIgA2siARAkGiAAIAAtAFwgAWo6AFwgACAAKQMAIAKtfDcDAAvxAQICfwF+IABBHGoiAyAALQBcIgJqQcAAIAJrECMgAyAALQBcakGAAToAACAAIAAtAFwiAkEBajoAXCACQfgBcUE4RgRAIAAgAxAiIANBwAAQIwsgAEHbAGogACkDACIEp0EDdDoAACAEQgWIIQRB2gAhAgNAIAJB0wBGRQRAIAAgAmogBDwAACACQQFrIQIgBEIIiCEEDAELCyAAIAMQIiAAQQhqIQNBACECA0AgAkEURkUEQCABIAJqIAIgA2ooAgAiAEEYdCAAQYD+A3FBCHRyIABBCHZBgP4DcSAAQRh2cnI2AAA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wDayICQQV3akGq/PSsA2siA0EedyIGIAJBHnciBXMgOSA9cyA/cyBIc0EBdyIJIARqIAcgCHMgAnNqIANBBXdqQar89KwDayICc2ogByBMaiAFIAhzIANzaiACQQV3akGq/PSsA2siBEEFd2pBqvz0rANrIgNBHnciCGogASAGaiAEQR53IgcgAkEedyICcyADc2ogOiA+cyBAcyAJc0EBdyIPIAVqIAIgBnMgBHNqIANBBXdqQar89KwDayIBQQV3akGq/PSsA2siBUEedyIGIAFBHnciBHMgAiA2ID5zIEhzIE1zQQF3IgJqIAcgCHMgAXNqIAVBBXdqQar89KwDayIDc2ogOyA/cyBLcyAPc0EBdyIBIAdqIAQgCHMgBXNqIANBBXdqQar89KwDayIIQQV3akGq/PSsA2siB0EedyIFIAtqNgIAIA0gTiA/IEFzIAlzIAJzQQF3Ig0gBGogA0EedyIEIAZzIAhzaiAHQQV3akGq/PSsA2siA0EedyICajYCACAMIEogPCBAcyBMcyABc0EBdyAGaiAIQR53IgsgBHMgB3NqIANBBXdqQar89KwDayIMQR53ajYCACAOIEkgQSBHcyBNcyBPc0EBdyAEaiAFIAtzIANzaiAMQQV3akGq/PSsA2siAWo2AgAgACBCIEAgSHMgD3MgDXNBAXdqIAtqIAIgBXMgDHNqIAFBBXdqQar89KwDazYCCAshACABBEADQCAAQQA6AAAgAEEBaiEAIAFBAWsiAQ0ACwsLQwEBfwJAIAJFDQAgAkEBayECIAAhAwNAIAMgAS0AADoAACACRQ0BIAJBAWshAiABQQFqIQEgA0EBaiEDDAALAAsgAAsLqgEEAEGAgMAAC3AyMzQ1Njc4OUJDREZHSEpLTU5QUVJUVldYWQBBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjIzNDU2NwABAAAAAgAAAAMAAAAAAAAAPAAQAAQAAAAFAAAABgAAAAAAAABQABAA8AAQABAAAAD/////AEGAgcAACwEBAEGQgcAACxQBI0VniavN7/7cuph2VDIQ8OHSwwBB6IHAAAsEqqqqqg=="; \ No newline at end of file diff --git a/packages/totp-wasm/index.js b/packages/totp-wasm/index.js index 05104fe..ab132ba 100644 --- a/packages/totp-wasm/index.js +++ b/packages/totp-wasm/index.js @@ -1 +1 @@ -function f(e,n){return e.exports.malloc(n+1)}function u(e,n){e.exports.free(n)}function b(e,n,o){let t=new TextEncoder().encode(o),s=f(e,t.length);return new Uint8Array(n.buffer,s,t.length).set(t),new Uint8Array(n.buffer,s+t.length,1).set([0]),{ptr:s,len:t.length}}var c=new WebAssembly.Memory({initial:250}),m={env:{memory:c}},r;async function g(e){if(r)return;r=(e instanceof Promise||e instanceof Response?await WebAssembly.instantiateStreaming(e,m):await WebAssembly.instantiate(e,m)).instance}function y(e,n,o){if(!r)return 0;let t=b(r,c,e),s=r.exports.hotp,i=s(t.ptr,t.len,n,o);return u(r,t.ptr),i}function x(e,n,o,t){if(!r)return 0;let s=b(r,c,e),i=r.exports.totp,p=i(s.ptr,s.len,n,o,t);return u(r,s.ptr),p}export{y as hotp,g as init,x as totp}; +function p(e,t){return e.exports.malloc(t+1)}function i(e,t){e.exports.free(t)}function b(e,t,o){let r=new TextEncoder().encode(o),s=p(e,r.length);return new Uint8Array(t.buffer,s,r.length).set(r),new Uint8Array(t.buffer,s+r.length,1).set([0]),{ptr:s,len:r.length}}var c=new WebAssembly.Memory({initial:250}),m={env:{memory:c}},n;async function g(e){if(n)return;n=(e instanceof Promise||e instanceof Response?await WebAssembly.instantiateStreaming(e,m):await WebAssembly.instantiate(e,m)).instance}function d(e,t,o){if(!n)return 0;let r=b(n,c,e),s=n.exports.hotp,u=s(r.ptr,r.len,t,o);return i(n,r.ptr),u}function x(e,t,o,r){if(!n)return 0;let s=b(n,c,e),u=n.exports.totp,a=u(s.ptr,s.len,t,o,r);return i(n,s.ptr),a}function y(e,t){if(!n)return"";let o=b(n,c,e),r=n.exports.steam_guard,s=r(o.ptr,o.len,t),u=new TextDecoder().decode(new Uint8Array(c.buffer,s,5));return i(n,o.ptr),i(n,s),u}export{d as hotp,g as init,y as steam_guard,x as totp}; diff --git a/packages/totp-wasm/index.ts b/packages/totp-wasm/index.ts index 62615a0..7fa0690 100644 --- a/packages/totp-wasm/index.ts +++ b/packages/totp-wasm/index.ts @@ -32,9 +32,24 @@ export function totp(secret: string, t: bigint, digit: number, period: number): return code } +export function steam_guard(secret: string, t: bigint): string { + if (!instance) return '' + const str = to_cstr(instance, memory, secret) + const steam_guard = instance.exports.steam_guard as steam_guard_func + const output_ptr = steam_guard(str.ptr, str.len, t) + const code = new TextDecoder().decode(new Uint8Array(memory.buffer, output_ptr, 5)) + free(instance, str.ptr) + free(instance, output_ptr) + return code +} + interface hotp_func { (ptr: number, len: number, counter: bigint, digit: number): number } interface totp_func { (ptr: number, len: number, t: bigint, digit: number, period: number): number } + +interface steam_guard_func { + (ptr: number, len: number, t: bigint): number +} diff --git a/packages/totp-wasm/mod.ts b/packages/totp-wasm/mod.ts index 243ccac..e853d14 100644 --- a/packages/totp-wasm/mod.ts +++ b/packages/totp-wasm/mod.ts @@ -1,3 +1,3 @@ //@ts-nocheck -export { hotp, totp, init } from './index.js' +export * from './index.js' export { wasm_data } from './dist/wasm_data.js' diff --git a/src/main.zig b/src/main.zig index b79708a..5b2b168 100644 --- a/src/main.zig +++ b/src/main.zig @@ -11,9 +11,11 @@ export fn totp(secret_ptr: [*]const u8, secret_len: usize, t: i64, digit: u32, p return otp.totp(secret_ptr[0..secret_len], t, digit, period) catch return 0; } -export fn steam_guard(secret_ptr: [*]const u8, secret_len: usize, t: i64) u32 { - _ = otp.steam_guard(secret_ptr[0..secret_len], t) catch return 0; - return 0; +export fn steam_guard(secret_ptr: [*]const u8, secret_len: usize, t: i64) [*]u8 { + var code = otp.steam_guard(secret_ptr[0..secret_len], t) catch @panic("steam_guard: steam_guard"); + const output: []u8 = allocator.alloc(u8, 5) catch @panic("steam_guard: allocator.alloc"); + @memcpy(output[0..5], code[0..5]); + return output[0..5 :0].ptr; } export fn malloc(size: usize) ?[*]const u8 { diff --git a/src/otp.zig b/src/otp.zig index afceee6..8ddb45e 100644 --- a/src/otp.zig +++ b/src/otp.zig @@ -61,7 +61,7 @@ test "totp test" { const STEAM_CHARS: *const [26:0]u8 = "23456789BCDFGHJKMNPQRTVWXY"; -pub fn steam_guard(secret: []const u8, t: i64) ![]u8 { +pub fn steam_guard(secret: []const u8, t: i64) ![5]u8 { const alloc = std.heap.page_allocator; var counter = @intCast(u64, @divFloor(t, 30)); var key = try base32.decode(alloc, secret); @@ -96,7 +96,7 @@ pub fn steam_guard(secret: []const u8, t: i64) ![]u8 { bin_code[i] = STEAM_CHARS[(fc % STEAM_CHARS.len)]; fc /= @intCast(u32, STEAM_CHARS.len); } - return bin_code[0..]; + return bin_code; } test "Steam Guard test" { @@ -104,5 +104,5 @@ test "Steam Guard test" { const t: i64 = 1662681600; const code = "4PRPM"; - try testing.expectEqualSlices(u8, code[0..], try steam_guard(secret, t)); + try testing.expectEqualSlices(u8, code[0..], (try steam_guard(secret, t))[0..]); }